我将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>
我在这里想念什么?
最佳答案
在可折叠小部件上使用expand method:
$("#set1").collapsible( "expand" );
另外,应该使用jQM pagecreate事件代替$(document).ready(...):
$(document).on("pagecreate", "#pageid", function(){...