Reputation: 59
echo <<<_END
<pre>
<a href="#home" data-rel="dialog" data-num="$row[1]" data-id="myid">$row[1]</a>
</pre>
_END;
<script>
var b = $('a#myid').data('num');
document.write(b);
</script>
How do I get data-num info from the tag when the link has been followed?
Upvotes: 0
Views: 159
Reputation: 48793
Add '=
' between attribute's name and value:
<a href="#home" data-rel="dialog" data-num="$row[1]">$row[1]</a>
// ^---here it is
and then retrieve it like this:
$('a').data('num')
Upvotes: 2