JQuery select items by name

I have the following html:

<td valign="top" align="left"> <input style="width:250px;" name="men_url" type="text" /></td> <td valign="top" align="left"> <select name="men_page"> <option value="">Wybierz stronฤ™</option> <option value="index.php?page=8">O firmie</option> <option value="index.php?page=9">Referencje</option> </select> </td> 

and two corresponding jQuery selectors:

 $("select[name='men_page']") 

and

 $("input[name='men_url']") 

The first works fine, the second does not return anything. What could be wrong here?

Especially the warning ($ ("input [name = 'men_url'"). Name); displays "undefined"

+4
source share
3 answers

also there is no property "name". Use $(..).attr('name') instead.

// Pozdrawiam;) / ["greetings", in polish];)

+3
source

In the second there is no closure ]

+8
source

he should be

 $("input[name='men_url']") 
+1
source

Source: https://habr.com/ru/post/1314025/


All Articles