[Javascript] Dollar function for name=
Terry Riegel
riegel at clearimageonline.com
Wed Jun 2 09:33:47 CDT 2010
> Try this then, again from Prototype since that's what you're using
>
> http://api.prototypejs.org/dom/element/writeattribute/
>
> so once more:
>
> $$('input[name="pizze"]').each(function(el){
> el.writeAttribute('value','sausage');
> });
>
> Not quite as neat as jquery though
Ok I'll give it a whirl, but as I read it it doesn't appear to handle the logic with radio and checkboxes.
Given...
<input type="radio" name="pizze" value="Sausage">
<input type="radio" name="pizze" value="Pepperoni">
<input type="radio" name="pizze" value="Ham">
Wouldn't your code leave it looking like...
<input type="radio" name="pizze" value="Sausage">
<input type="radio" name="pizze" value="Sausage">
<input type="radio" name="pizze" value="Sausage">
What I would want it to do is leave it looking like...
<input type="radio" name="pizze" value="Sausage" checked="true">
<input type="radio" name="pizze" value="Pepperoni">
<input type="radio" name="pizze" value="Ham">
Thanks,
Terry
More information about the Javascript
mailing list