jQueryUI accordion with checkboxes

前端 未结 4 1468
遥遥无期
遥遥无期 2020-12-19 02:32

I\'m trying to put a checkbox in each of my accordion headings to indicate whether something should be disabled or not. The checkbox shows up fine, however, its not clickabl

相关标签:
4条回答
  • 2020-12-19 02:32
    <input type="checkbox" onclick="event.stopPropagation()" />
    
    0 讨论(0)
  • 2020-12-19 02:37

    Try setting the checkbox to checked in the acordion click event, using

    <input type="checkbox" name="foo" />
    

    in the html and

    $('input[name=foo]').attr('checked', true);
    

    in the event.

    0 讨论(0)
  • 2020-12-19 02:47

    I would be taking the input control out of the hyperlink.

    <h3><a href="#">Text</a><span id="id">More text<input type="checkbox"/></span></h3>
    
    0 讨论(0)
  • 2020-12-19 02:55

    You can use stopPropagation() to fix this

    example jsfiddle

    something like

    $('#accordion input[type="checkbox"]').click(function(e) {
        e.stopPropagation();
    });
    
    0 讨论(0)
提交回复
热议问题