Getting parent of element with jQuery

danev

New Member
I'm learning jQuery, so it's probably misunderstanding of some sort.Consider javascript:\[code\]var controls = $("#" + val.controltovalidate);var input = controls[0];var parent = input.parent(); var pos = parent.position;\[/code\]First I'm getting list of elements with specific ID, since it is in ASP.NET I know it's just one element but I'm using jQuery and it gives me list. I also prepend with "#" to make it works. Any better way?Second I get actual element (array at 0) \[code\]HtmlInput\[/code\]Third I want to find it's container and I'm doing \[code\]input.parent()\[/code\]. This call returns NULL for me. Why? I know there is parent \[code\]P\[/code\] for this \[code\]input\[/code\]
 
Back
Top