-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
  • 5,829
  • 24
  • 75
  • 100
  • 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
  • 27,470
  • 11
  • 72
  • 109
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
  • 36,377
  • 12
  • 75
  • 137
0

You can use the attribute selector like so:

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