-1

In JQuery , how to get the object of 'name' input with selector ? like

$("#myform>name")

<form id='myform'>
   <input name='name' type='text' />
</form>

thanks

user595234
  • 6,007
  • 25
  • 77
  • 101
  • 1
    possible duplicate of [How can I select an element by name with JQuery?](http://stackoverflow.com/questions/1107220/how-can-i-select-an-element-by-name-with-jquery) – Cilan Jan 11 '14 at 17:04

3 Answers3

0

try:

$("#myform > input[name='name']")

or use direct by attribute selector if there is only element with this attribute value combination:

$('input[name="name"]')
Zaheer Ahmed
  • 28,160
  • 11
  • 74
  • 110
0

This should work.

$('#myform > input[name="name"]')

There are other ways too but this is exactly what you asked
about (it selects all input elements with name name which
are below myform in the DOM tree).

peter.petrov
  • 38,363
  • 16
  • 94
  • 159
0

You can use the attribute selector like so:

$('input[name="name"]');
Arnelle Balane
  • 5,437
  • 1
  • 26
  • 32