Link to home
Create AccountLog in
Avatar of JoshWegener
JoshWegener

asked on

Replace a dropdown with prototype.

Lets say we have a dropdown, I want to remove all the current options, and place new ones in the dorpdown.

for example, the drop down says  a, b, c ... I wnat to change them to 1, 2, 3 .. how do I got about this using prototype?
Avatar of geodan7
geodan7
Flag of United States of America image

Check this out...the code is an image...but they have a prototype that creates a dropdown list.

http://jayandsilentrob.com/2006/07/31/web-20-tricks-with-prototype-creating-a-drop-down-list/
Avatar of JoshWegener
JoshWegener

ASKER

if I do $('spanID').innerHTML = '<select><option>bla</option><select>' it works... but I need to leave the select alone... if I do, $('selectID').innerHTML = '<option>bla</option>' it does not work... any idea?
Avatar of hielo
save the attached code as test.html and try it:
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.