Results 1 to 2 of 2
Jan 10, 2008, 23:24 #1
- Join Date
- Jan 2008
- 0 Post(s)
- 0 Thread(s)
I am trying to figure this out now for a bit and its driving me nuts.
I have values in a database that are for a select box they are not in a certain order so .listindex is out of the order. I know the value of the select box and send that to my function. how can i change the selected on without listindex.
like i know the right value is abc
<option SELECTED value="abc">abc</select>
see what i want to do is be able to change the selected from one to the other with a function without using listindex as i know how to do that already. and i can't use a if statement on values like abc as they could change if the database values change.
Jan 11, 2008, 00:18 #2
- Join Date
- Jan 2007
- Christchurch, New Zealand
- 61 Post(s)
- 3 Thread(s)
// set the selected attribute optionElement.setAttribute('selected', 'selected'); // get the selected attribute from the element value = optionElement.getAttribute('selected'); // remove the selected attribute optionElement.removeAttribute('selected');Programming Group Advisor
The 2013 SitePoint Awards - Nominate your heroes now!