如何为日期选择器输入设置段落样式?

时间:2019-10-28 13:35:46

标签: javascript html css datepicker

我制作了一个小日历应用程序,其中可以添加带有开始日期和重复设置的事件。因此,它可以每天,每周或每月发生。如果您选择每日重复,则在此代码段中可以看到文本。

现在我想知道是否可以将Datefield样式设置为仍然具有dropdown-datepicker的普通段落。我该怎么办?

function rrendClose() {
    document.getElementById('dailyText').innerText = "Takes place every day.";
    document.getElementById('dailyEnddate').style.visibility = "collapse";
    document.getElementById('dailyDismiss').style.visibility = "collapse";
    document.getElementById('showFullDaily').style.visibility = "visible";
  }

  function rrendOpen() {
    document.getElementById('dailyText').innerText = "Takes place every day, until";
    document.getElementById('dailyEnddate').style.visibility = "visible";
    document.getElementById('dailyDismiss').style.visibility = "visible";
    document.getElementById('showFullDaily').style.visibility = "collapse";
  }
<div class="row">
    <p class="pt-1"><p class="ml-3" id="dailyText">Takes place evry day, until</p>
    <a id="showFullDaily" class="link" onclick="rrendOpen();" style="visibility: collapse;" >Add enddate</a>
    <input name="rrend" class="col-5 form-control border border-dark auto-date" type="date" id="dailyEnddate" value="{{date("d.m.Y")}}">
    <button type="button" id="dailyDismiss" class="close col-1" aria-label="Close" onclick="rrendClose();">
        <span aria-hidden="true">&times;</span>
    </button></p>
</div>

2 个答案:

答案 0 :(得分:1)

一些更改:

  • 删除与文本框相关的样式(特别是边框和填充),然后使其“继承”字体样式。
  • showFullDaily已切换为使用display属性而不是visibility,因为后者虽然可见地隐藏了元素,但保留了文本应留的空间,而显示却没有。 / li>
  • dailyTextp标记更改为span,因为1)p标记不应相互嵌套,而2)span是一个内联元素,因此它自然可以继续进行流程而无需其他样式。所有这些更改一起使输入元素可以折叠并随段落流动。

function rrendClose() {
    document.getElementById('dailyText').innerText = "Takes place every day.";
    document.getElementById('dailyEnddate').style.visibility = "collapse";
    document.getElementById('dailyDismiss').style.visibility = "collapse";
    document.getElementById('showFullDaily').style.display = "block";
  }

  function rrendOpen() {
    document.getElementById('dailyText').innerText = "Takes place every day, until";
    document.getElementById('dailyEnddate').style.visibility = "visible";
    document.getElementById('dailyDismiss').style.visibility = "visible";
    document.getElementById('showFullDaily').style.display = "none";
  }
#dailyEnddate {
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
}
<div class="row">
    <p class="pt-1"><span class="ml-3" id="dailyText">Takes place evry day, until</span>
    <a id="showFullDaily" class="link" onclick="rrendOpen();" style="display: none;" >Add enddate</a>
    <input name="rrend" class="col-5 form-control border border-dark auto-date" type="date" id="dailyEnddate" value="{{date("d.m.Y")}}">
    <button type="button" id="dailyDismiss" class="close col-1" aria-label="Close" onclick="rrendClose();">
        <span aria-hidden="true">&times;</span>
    </button></p>
</div>

答案 1 :(得分:0)

转到CSS并输入:

declare evid integer;
declare cur cursor;

evid = 1;

open cur

//Do Insert Into
//Evid +1;
Close cur;