Hi, the syntax you need for selecting by ID is this:

$("#identifier")

so to find the element with ID 'aller' you want:

$("#aller")



Bear in mind that the $() function does not return a DOM object, it returns
a jQuery object.
If you want to access a DOM property such as selectedIndex, you will need to
retrieve the DOM object like this:

alert($("#aller")[0].selectedIndex);


Remember also that that line will generate an error if there is no element
found with ID 'aller'.

I hope that explains it for you :-)
--rob


On 7/2/07, debussy007 <[EMAIL PROTECTED]> wrote:



Hi,

I am trying to access my SELECT element with jQuery but I can't make it
working :

This works :
                 alert(document.getElementById('aller'));     //  [object]
                 var sel = document.getElementById('aller');
                 alert(sel.selectedIndex);       // 0
This not working :
                 alert($(document.aller));   // [object Object]
                 alert($(document.aller).selectedIndex);   // undefined

Could anyone help me ?

Thank u for any comment.


--
View this message in context:
http://www.nabble.com/%24%28elem%29--question-tf4011702s15494.html#a11392465
Sent from the JQuery mailing list archive at Nabble.com.




--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
"There's a whale there's a whale there's a whale fish" he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.

Reply via email to