【问题标题】:How can we change button to select options [closed]我们如何更改按钮以选择选项[关闭]
【发布时间】:2019-04-25 00:25:41
【问题描述】:

enter image description here我想更改以下代码以选择选项并执行这些功能

<div class="dropdown">
    <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" id="button1">Date Range
    <span class="caret"  id="car"></span><i class="fa fa-calendar"></i>&nbsp;</select>

    <ul class="dropdown-menu">
        <li><input type="checkbox" class="chb" name="checkfield" id="checkboxes"  onchange="today(this)">Today</li>
        <li><input type="checkbox" class="chb" name="checkfield" id="checkboxes"  onchange="lastweek(this)">Last 7 Days</li>
        <li><input type="checkbox" class="chb" name="checkfield" id="checkboxes"  onchange="last30days(this)">Last 30 Days</li>
        <li><input type="checkbox" class="chb" name="checkfield" id="checkboxes"  onchange="presentmonth(this)">This Month</li>
        <li><input type="checkbox" class="chb" name="checkfield" id="checkboxes"  onchange="lastmonth(this)">Last Month</li>
        <li><input type="checkbox" class="chb" name="checkfield" id="checkboxes"  onchange="yesterday(this)">Yesterday</li>
        <li><input type="checkbox" class="chb" name="checkfield" id="checkboxes"  onchange="today(this)">Custom Range</li>
    </ul>
</div>

Change the second image to the first, the code is for the second image

【问题讨论】:

  • 您显示的代码已经有一个选择字段一个复选框列表 - 所以不清楚您在这里真正想要什么。请努力正确解释您拥有什么、您需要什么以及您遇到的具体问题。
  • 如果我点击一个选项,它应该会显示
  • 我的意思是,超链接复选框和标签,当我选择时,它应该显示,我认为它不应该是一个按钮??

标签: javascript html css


【解决方案1】:

据我了解,您只需要选择一个复选框?

如果是这样,它已经回答了: html select only one checkbox in a group

对于选中的操作添加“onchange”(就像你已经做的那样,juste custome checkbox跟随today()函数)并做你想要的(不要忘记检查复选框的状态(选中与否))

【讨论】:

  • 谢谢,但我想要一个
  • 编辑你的帖子还不是很清楚:/
猜你喜欢
  • 2017-03-31
  • 2014-05-31
  • 2014-07-20
  • 1970-01-01
  • 2016-10-24
  • 1970-01-01
  • 2011-05-30
  • 2015-08-17
  • 1970-01-01
相关资源
最近更新 更多