Web Hosting Talk







View Full Version : Custom attributes for HTML tags


sasha
09-13-2006, 07:53 PM
In administration interfaces for my sites I sometimes do things like this

<select onchange="roughMeUp(this)">
<option value="some value" attribute1="blah" rawdata="blah2">This is blah</option>
</select>


function roughMeUp() could look like this


function roughMeUp(obj){
var opt = obj.options[obj.selectedIndex]
alert (opt.getAttribute('attribute1') + ' ' +opt.getAttribute('rawdata') )
}


Now I am thinking about using this for public sites too. I am wondering if there is any good reason not to use custom attributes for HTML tags. Comments ?

Googled
09-13-2006, 10:21 PM
Never saw anything like that. I will surely look forward into using this 'custom hack'.

Thanks,

G