javascript - Using getSelected in MooTools -


i'm new js , mootools , i've been having funny error using getselected() mootools 1.3.2. i've looked @ other posts have similar code, haven't been successful. i'm using getselected try , value of option , reason, browser isn't calling it.

here's html

<select id="id_method" name="method">     <option selected="selected" value="">---------</option>     <option value="au">auction (best price wins)</option>     <option value="fi">fixed price</option>     <option value="fr">free item/donation</option>     <option value="mu">multiple items , prices</option>     <option value="no">no price displayed</option>     <option value="tr">trade</option> </select> 

here's js

window.addevent('domready', function() {     ...      $('id_method').addevent('change', function() {         alert(this.getselected().selection[0].value);     }); }); 

here's attempt @ putting in in jsfiddle: http://jsfiddle.net/jnyud/

i know silly question, i'd appreciate help. thanks!

the result of calling getselected() returns array, pure , simple. need @ first element of array. replace alert one:

alert(this.getselected()[0].value); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -