By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,625 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,625 IT Pros & Developers. It's quick & easy.

2 questions about <option> elements

P: n/a
abs
Hi all.

Two questions.
1. Anybody knows how to add and remove the <option value="myvalue"> elements
from the <select> type of field in the form ?
2. How to change <option value="myvalue"> into <option value="myvalue"
selected> and <option value="myvalue" selected> into <option
value="myvalue"> ?

Best regards,
ABS
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
abs wrote:
Hi all.

Two questions.
1. Anybody knows how to add and remove the <option value="myvalue">
elements from the <select> type of field in the form ?
createElement, removeChild
http://www.w3.org/DOM/DOMTR
2. How to change <option value="myvalue"> into <option value="myvalue"
selected> and <option value="myvalue" selected> into <option
value="myvalue"> ?


setAttribute, removeAttribute ... or, IIRC, fiddle with the select element's
selectedIndex property.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2

P: n/a
abs wrote:
Hi all.

Two questions.
1. Anybody knows how to add and remove the <option value="myvalue"> elements from the <select> type of field in the form ?
2. How to change <option value="myvalue"> into <option value="myvalue" selected> and <option value="myvalue" selected> into <option
value="myvalue"> ?

Best regards,
ABS


http://www.faqts.com/knowledge_base/index.phtml/fid/178

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.