Custom Attributes for HTML Tags
Did you know that you can use any custom attributes for your HTML tags? For example:
<div id=’myDiv’ firstName=’John’></div>
Now, in your JavaScript code, you get the value of your custom attribute as follows:
var div = document.getElementById (’myDiv’);
var fName = div.getAttribute(’firstName‘);
This technique may prove useful if you manipulate and re-arrange HTML elements on your web page.
