Re: [jQuery] getting the selectedIndex of a dynamic select

2007-03-26 Thread Dan G. Switzer, II
Rob, >Ok I think that may answer the next question. >Are you saying that an assertion: > $(this)[0] == this >will always be true? No, what he's saying is the "this" in $(this) is actually a reference to the DOM element. So, in the code: $("#myDiv").click( function (){

Re: [jQuery] getting the selectedIndex of a dynamic select

2007-03-26 Thread Rob Desbois
Ok I think that may answer the next question. Are you saying that an assertion: $(this)[0] == this will always be true? In other words, if I am using ID selectors and want to access a DOM property/method should I read the first element or can I just use the jQuery: $("#myDiv").selectedIndex;

Re: [jQuery] getting the selectedIndex of a dynamic select

2007-03-26 Thread Klaus Hartl
Dan G. Switzer, II schrieb: > Rob, > >> I thought a jQuery object consisted of extended DOM objects - i.e. all DOM >> methods and properties are available, plus the jQuery extensions. > > To get to the actual DOM element, you'd use: > > alert( $(this).get(0).selectedIndex ); > > -- or -- > > a

Re: [jQuery] getting the selectedIndex of a dynamic select

2007-03-26 Thread Dan G. Switzer, II
Rob, >I thought a jQuery object consisted of extended DOM objects - i.e. all DOM >methods and properties are available, plus the jQuery extensions. To get to the actual DOM element, you'd use: alert( $(this).get(0).selectedIndex ); -- or -- alert( $(this)[0].selectedIndex ); (Where 0 would re

Re: [jQuery] getting the selectedIndex of a dynamic select

2007-03-26 Thread Rob Desbois
I thought a jQuery object consisted of extended DOM objects - i.e. all DOM methods and properties are available, plus the jQuery extensions. On 3/24/07, Brian Cherne <[EMAIL PROTECTED]> wrote: var valueOfSelected = $("#list [EMAIL PROTECTED]").val(); And, instead of onClick you probably want t

Re: [jQuery] getting the selectedIndex of a dynamic select

2007-03-24 Thread Brian Cherne
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 (whic

[jQuery] getting the selectedIndex of a dynamic select

2007-03-24 Thread narven
Hi, Im having some problems getting the value of selectedIndex of a select box. im using... // this is populated dynamic using ajax $(function() { $('#list').bind('click', function() { alert( $(this).selectedIndex ); }); }) But always gives me un