html data attribute and jquery

by Prakash 2013-07-16 16:14:59

We can store data on html using the 'data' attribute used on a tag and access via jquery like below :


<input type="hidden" id="playall" data-status="mydata">

<script>
var videoid = $("#videoid").data('status');
alert(videoid); /*alert as 'mydata*/
</script>

Tagged in:

1086
like
0
dislike
0
mail
flag

You must LOGIN to add comments