将复选框添加到jquery mobile中的可折叠列表标题中
Adding checkbox to collapsible list header in jquery mobile
我在jQuery Mobile网站上遇到了一个问题。我正在开发一个带有可折叠列表的jQuery移动网站(http://dev.sreejesh.in/jqmobile/inbox.html)。
我的客户端需要在标题中有一个复选框,这样用户就可以在不打开列表的情况下检查列表。我试着把它放在里面,但效果不好。复选框出现,但无法单击。我在谷歌上搜索了很多,但找不到解决方案。希望你们能帮助我。。。。。
这应该可以工作。如果你有不止一个,一定要给你的复选框一个唯一的ID。也不要忘记复选框标签。
<div id="collapsibleSetWrapper" data-role="collapsible-set">
<div data-role="collapsible" data-collapsed="true">
<h3>
<span>some title</span>
<input class="mycheckbox" type="checkbox" id="uniqueID"/>
<label for="uniqueID"> </label>
</h3>
<div id="mycontent">
<p>this is the content</p>
</div>
</div>
</div>
<script>
$('#collapsibleSetWrapper .mycheckbox').checkboxradio({
create: function(event,ui){
var checkbox = $(event.target);
var clickTarget = $(event.target).parent();
$(clickTarget).click(function(e){
if($(checkbox).is(':checked')){
$(checkbox).attr("checked",false).checkboxradio("refresh");
// select all the nested checkboxes here
}
else{
$(checkbox).attr("checked",true).checkboxradio("refresh");
// unselect all the nested checkboxes here
}
e.preventDefault();
return false;
});
}
})
</script>
相关文章:
- jQuery与可折叠列表冲突
- 可折叠/不可折叠的列表视图类似于Word大纲视图
- 更高效的可折叠列表定位
- 纯 js 中的可折叠列表优化
- 使有序列表可折叠
- 使用jQuery可折叠列表 - 如何更新展开/折叠全部按钮
- 可折叠onclick事件中的Jquery Mobile列表没有'动态添加时无法工作
- jquery移动列表视图和可折叠集在返回时打开
- Javascript可折叠列表和xsl
- 使用移动版jquery和cordova时,可折叠列表视图的头部不能刷新
- 动态添加可折叠集和嵌套列表在jQuery移动
- 可折叠的列表
- 如何获得一个Jquery移动按钮打开特定的可折叠列表Id
- 具有动态加载内容的可折叠列表
- 如何管理可折叠列表
- jQuery扩展可折叠列表视图的过滤器
- 如何将多个事件添加到可折叠列表
- 将复选框添加到jquery mobile中的可折叠列表标题中
- 列表视图内部可折叠面板的平滑动画
- 清除动态可折叠列表,空() html(“ ”)不起作用