writeAttribute() example
By Iain Cuthbertson
The documentation on http://prototypejs.org/api/element/writeAttribute is a wee bit scarce. So here’s a quick one on usage.
To add an attribute:
$('foo').writeAttribute('title', 'bar');
To remove an attribute:
$('foo').writeAttribute('title', null);
To enable all disabled form elements (in a form with the id ‘container’):
$('container').select('[disabled="disabled"]').each(function(e) {
$(e).writeAttribute('disabled', null);
});