Sunday, 8 September 2013

Retrieve text within an attribute using jQuery?

Retrieve text within an attribute using jQuery?

For starts I have this HTML with example data within it:
<div class="card {toggle:'someinformation'}">
<div class="off"></div>
<div class="on {toggle:'getThisInfo'}"></div>
</div>
I want to use jQuery and retrieve this information. Upon asking someone
they told me to use the follow (which did not work):
var $card = $(this);
var this_card = $card.children(".on").metadata()["toggle"];
and was told the value of "this_card" would be 'getThisInfo' -- which it
did not work. And yes, I did make sure metadata was included in HTML and
jQuery as well.
Any other suggestions?

No comments:

Post a Comment