Get id for data-collapsed
Description
The following code shows how to get id for data-collapsed.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type="text/javascript"
src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css">
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!-- w w w.j ava2 s . co m-->
var thisID;
$(".getID").click(function(e) {
if($(this).parent(".userList").attr('data-collapsed', false)){
thisID = $(this).attr("id");
alert(thisID);
}
});
});//]]>
</script>
</head>
<body>
<div data-role="page" id="myPage">
<h3>Current Clients</h3>
<div data-role="collapsible-set">
<div data-role='collapsible' data-collapsed='true' class='userList'>
<h3 id='1' class='unverified getID'>A</h3>
<div>
<p>collapsed content 1</p>
</div>
</div>
<div data-role='collapsible' data-collapsed='true' class='userList'>
<h3 id='2' class='verified getID'>B</h3>
<div>
<p>collapsed content 2</p>
</div>
</div>
</div>
</div>
</body>
</html>