Getting elements children with certain tag jQuery
Posted
by johnnyArt
on Stack Overflow
See other posts from Stack Overflow
or by johnnyArt
Published on 2010-03-12T10:29:14Z
Indexed on
2010/03/12
10:37 UTC
Read the original article
Hit count: 324
I'm trying to get all the input elements from a certain form from jQuery by providing only the name of the form and only knowing that those wanted fields are input elements.
Let's say:
<form action='#' id='formId'>
<input id='name' />
<input id='surname'/>
</form>
How do I access them individually with jQuery?
I tried something like $('#formId > input')
with no success, in fact an error came back on the console "XML filter is applied to non-XML value (function (a, b) {return new (c.fn.init)(a, b);})"
Maybe I have to do it with .children or something like that? I'm pretty new at jQuery and I'm not really liking the Docs. It was much friendlier in Mootools, or maybe I just need to get used to it.
Oh and last but not least, I've seen it asked before but no final answer, can I create a new dom element with jQuery and work with it before inserting it (if I ever do) into de code? In mootools, we had something like var myEl = new Element(element[, properties]);
and you could then refer to it in further expressions, but I fail to understand how to do that on jQuery
Thanks in advance.
© Stack Overflow or respective owner