【问题标题】:JQM: Is it possible to put controlgroups inside a collapsible bar and not propagate the click event?JQM:是否可以将控件组放在可折叠栏内而不传播点击事件?
【发布时间】:2013-03-30 19:49:16
【问题描述】:

我真正的愿望是为 JQM 创建一个可选择的树(每个元素有 3 个值)。我尝试使用嵌套的可折叠分区,这很好用。但是当我尝试在每个可折叠栏上添加 3 个收音机时,事件无法正常触发。

我认为折叠/展开事件挂钩了收音机的点击事件。效果是当您单击单选时,可折叠项会展开,而单选不会被选中。

<div data-role="collapsible" data-theme="b" data-content-theme="d" id="accordion1">
<h3>60
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" >
    <input type="radio" name="selcrit-CLP-60" id="selcrit-CLP-60-asign" value="60-asign">
    <label for="selcrit-CLP-60-asign">Asign</label>
    <input type="radio" name="selcrit-CLP-60" id="selcrit-CLP-60-omit" value="60-omit">
    <label for="selcrit-CLP-60-omit">Omit</label>
    <input type="radio" name="selcrit-CLP-60" id="selcrit-CLP-60-nothing" value="60-nothing">
    <label for="selcrit-CLP-60-nothing">Nothing</label>
</fieldset>                                                         
</h3>                               
<div stylee="margin: 0 10px;">
    Content for 60
</div>

这是带有示例的 jsfiddle:http://jsfiddle.net/Hz8Ef/

有什么想法吗?我可以用其他方式吗?

【问题讨论】:

    标签: jquery-mobile jquery-events collapsable


    【解决方案1】:

    解决了!

    $(document).ready(function() {
    $("div .ui-radio").click(
        function(e){                            
            var radioId = $(this).children(":first").attr('name');
            $('input[name=' + radioId + ']').checkboxradio( "refresh" );
            e.stopPropagation();
            }
        );
    

    });

    这里是完整的解决方案:http://jsfiddle.net/VuaQg/1/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-02
      • 2014-12-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多