var valueOfSelected = $("#list [EMAIL PROTECTED]").val();

And, instead of onClick you probably want to use onChange.

Note, when you are in the function "this" refers to the DOM object that
fired the event (that has selectedIndex). When you wrap it in $(this) you
then have the jQuery object (which does not have selectedIndex, but can be
used for all other jQuery events/methods).

I hope this helps,

Brian.

On 3/24/07, narven <[EMAIL PROTECTED]> wrote:

 Hi,



Im having some problems getting the value of selectedIndex of a select
box.



im using...





// this is populated dynamic using ajax

<select id="list" name="list" size="15"></select>



$(function() {



$('#list').bind('click', function() {

            alert( $(this).selectedIndex );

});





})





But always gives me undefined :|

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to