【问题标题】:jQuery button refuses to stylejQuery按钮拒绝样式
【发布时间】:2012-11-10 22:04:19
【问题描述】:

我正在尝试根据网站上的说明设置我的 jQuery 按钮的样式,但它不起作用。我按照这里的说明进行操作:http://jqueryui.com/button/#checkbox

我做错了什么?这是我的代码:http://jsfiddle.net/YrNxy/

HTML

    <div style="padding-bottom: 10px; padding-top: 10px;">
      <div class="modal_field">Day <strong style="color:#A00">(required)</strong>:</div>
      <div class="format">
        <input type="checkbox" class="check1" />
        <label for="check1">Mon</label>
        <input type="checkbox" class="check2" />
        <label for="check2">Tues</label>
        <input type="checkbox" class="check3" />
        <label for="check3">Wed</label>
        <input type="checkbox" class="check4" />
        <label for="check4">Thu</label>
        <input type="checkbox" class="check5" />
        <label for="check5">Fri</label>
      </div>
    </div>​

JS

$(function() {
        $( ".check" ).button();
        $( ".format" ).buttonset();
    });​

【问题讨论】:

  • 什么是button和buttonset?我看到 jquery ui。
  • 嗨,史蒂文。我按照这里的说明进行操作:jqueryui.com/button/#checkbox
  • input 元素需要使用id 作为button()buttonset() 的选择器,工作方法:updated demo

标签: jquery jquery-ui jquery-ui-button


【解决方案1】:

问题是您的输入设置不正确。我为您修复了 JSBin 上的代码。请注意,复选框的类已更改为 id(对于 = id 或标签和复选框的名称)。

http://jsbin.com/akulas/1/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-08
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    相关资源
    最近更新 更多