Hello everyone,
I'm a fairly new to javascript and I need some help regarding element
IDs.
What I need is a simple javascript action that is attached to a
checkbox that upon checking and unchecking changes the id= attribute of
the button named search (name="search")
initially the button is checked and id should be set at "searchbutton"
(id="searchbutton")
when the checkbox is unchecked I want id of that button to change:
id="button".
I searched the web for few hours and haven't found any examples.
here's my approximate scenario
if (document.myform.mycheckbox.checked == true) {
somehow change button.id to "searchbutton" }
else if (document.myform.mycheckbox.checked == false)
change button.id to "button" }
I'm not even sure if changing id of the element is possible since I was
trying to use getElementById and then the ID changes.
Any suggestions? If possible a short example is appreciated.
Regards,
Peter