I have a custom attribute called data-role and I\'d like to find all elements where data-role=\"content\" in jQuery.
jQuery select by attribute selector:
$('[data-role="content"]')
And for an array use .each(); instead of for
.each();
for
$('[data-role="content"]').each(function(){ alert($(this).html()); });