I want to make up some new attributes for elements like <div> and <a>. Those new attributes will be used to store data to be used by click handler jquery code. Is that ok to do? Is it supported by older browsers? Testing on IE8 and Chrome, I am able to use jquery to store and recall in these made up attributes of a <DIV>element. ( I tried to use expression web super preview to test the code. But apparantly, super preview does not run javascript. )thanks,
<div id="div1" MadeUpAttr="abc"></div>
<script type="text/javascript"> $(document).ready(function () { var s1 = $('#div1').attr('MadeUpAttr'); alert('MadeUpAttr: ' + s1);
$('#div1').attr('MadeUpAttr', 'efg'); var s2 = $('#div1').attr('MadeUpAttr'); alert('MadeUpAttr: ' + s2); }); </script>
View Complete Post