Reputation:
I need your help in grammatically expanding a Jquery's Collapsable div
I have tried with number of options
This is my fiddle
I have tried as following
<div data-role="content" class="data">
<div class="my-collaspible" id="first" data-inset="false" data-role="collapsible">
<h3>Header 1</h3>
<p>Content</p>
<p>Content</p>
</div>
<div class="my-collaspible" id="second" data-inset="false" data-role="collapsible">
<h3>Header 2</h3>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</div>
$(document).ready(function() {
var id = 'first';
$("#" + id).trigger('expand').collapsible("refresh");
});
Could you please let me know how to do this ??
Upvotes: 0
Views: 1951
Reputation: 11
("#myCollapsible").collapsible("expand");
This worked for me when using jQuery 1.11.1 and JQM 1.4.5
Upvotes: 1
Reputation: 323
You can use this:
<div data-role="collapsible-set">
<div id="first" data-role="collapsible">
<h3>Header 1</h3>
<p>Content</p>
<p>Content</p>
</div>
<div id="second" data-role="collapsible">
<h3>Header 2</h3>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</div>
<input type="button" value="Test" id="btn1" />
and JS:
$(document).ready(function() {
$("#first").collapsible('expand');
//test
$('#btn1').click(function(){
$("#first").collapsible('collapse');
});
});
Upvotes: 1
Reputation: 20636
Use following option : collapsible
,
$("#" + id).collapsible( "option", "collapsed", false );
Upvotes: -1