<select name="DropList" id="serverDropList">
<option selected="selected" value="2">server1:3000</option>
<option value="5">server3:3000</option>
</select>
i know in prototype i can get value by $('serverDropList').value but how can i get “server1:3000” ?
I don’t think Prototype has any shortcut that does that for you, so:
…gives you the
innerHTMLof the selected option, orundefinedif there is none.If you like, you can use
Element#addMethodsto define this once and have it available on all of your select boxes:Usage:
I used a named function when defining that. If you’re not bothered about named functions (I am, I always use them), you can make it a bit simpler: