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 (){
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;
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
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
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
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
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