Change Element Style on Select
Posted: Sun Oct 19, 2008 11:35 pm
Hi All,
I am writing a page, and I have a setup where I have a form of id="stickyform" and it is currently set to class="classic-yellow". I have a drop-down where the user can select several different colors, each one is linked to a class, for example "classic-green". I want to change the class of the form to reflect the one selected in the drop down.
In other words, as you select a different color (class), the class of the form should change to the color (class) selected.
I don't know very much JavaScript, so could someone please propose the easiest to implement solution?
I suspect it will be something along the lines of the following added to each <option> element:
onClick="target element with id 'stickyform' and modify style to be 'insert-style-here' "
Thank you very much,
OmniUni
I am writing a page, and I have a setup where I have a form of id="stickyform" and it is currently set to class="classic-yellow". I have a drop-down where the user can select several different colors, each one is linked to a class, for example "classic-green". I want to change the class of the form to reflect the one selected in the drop down.
In other words, as you select a different color (class), the class of the form should change to the color (class) selected.
I don't know very much JavaScript, so could someone please propose the easiest to implement solution?
I suspect it will be something along the lines of the following added to each <option> element:
onClick="target element with id 'stickyform' and modify style to be 'insert-style-here' "
Thank you very much,
OmniUni