I’m using jQuery Mobile and I have this html:
<ul id="thelist" data-corners= "false" >
<div class = "theListItem" data-role="collapsible-set" data-collapsed="false">
<div data-role="collapsible" data-collapsed="false" data-theme="a">
<h3>$1.48 - 10/31/2012 - niko Reade #14410 - Brooklyn Ny</h3>
<div data-role="controlgroup" data-type="horizontal">
<a class= "green" href="categorize.html" data-transition="slide" data-direction="reverse" data-role="button">Yes</a>
<a class="red" href="#" data-role="button">No</a>
<a class= "blue" href="IDontKnow.html" data-transition="slide"data-role="button">I don't know</a>
</div>
</div>
</ul>
And I’m trying to animate the drop down, but I’m having trouble selecting it. Here is my JS:
$('#transPage, #categorizePage, #IDKPage').live('pageinit', function() {
$('.trans .theListItem h3').click(function() {
var $controlGroup = $(this).children('.ui-collapsible-content').css("background-color", "#ff3333");
});
});
.ui-collapsible-content works well in the CSS, but doesn’t work when I try to use it with JS. Any idea why my selector is wrong, and how to animate the collapsible content? Thanks.
</div>at the end..liveis deprecated. See here.There are no child elements inside the
h3element with the classui-collapsible-content, in fact, there is only text inside theh3element.Make sure you have the latest version, because there seem to be some problems associated with the
pageinitevent for some of the older ones. Make sure that the event is executed.