我div
与role="collapsible"
有<script>
$(document).ready(function(){
$('#download').click(function () {
console.log("ok"); // this executes
$("#set1").trigger("expand"); // but this doesn't
//document.getElementById("set1").setAttribute("data-collapsed", "false"); also tried this but no luck.
});
});
</script>
<p data-theme="a"><a id="download" href="#" class="ui-btn">DOWNLOAD</a></p>
<div data-role="collapsible" id="set1" data-collapsed="true">
<h3>INSTRUCTIONS</h3>
<p><b> Before install ...</b></p>
<p>-- text....</p>
<p>-- text...</p>
</div>
,我尝试在用户点击下载按钮时展开它,但它不能正常工作,这里是代码:\ n
{{1}}
我在这里错过了什么?
答案 0 :(得分:1)
在可折叠小部件上使用 expand method :
$("#set1").collapsible( "expand" );
另外,代替$(document).ready(...,你应该使用jQM pagecreate事件:
$(document).on("pagecreate", "#pageid", function(){...