views:

54

answers:

3

Hello, 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 one works great, the second one returns nothing. What might be wrong here?

Especially alert($("input[name='men_url'").name); displays "undefined"

+8  A: 

The 2nd one is missing the closing ]

rosscj2533
This was only a mistake while copying. Sorry for that. The problem is different.
kubal5003
+1  A: 

it should be

$("input[name='men_url']")
Tobias P.
+3  A: 

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

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

migajek
Actually there is. In pure JS :) But you have to use: `$('.selector')[0].name` (that [0] thing is mandatory, either you use ID or Class selector)
Ionut Staicu
This is the answer! Thank you. Code that works: $("[name='men_url']")[0].nameI feel sorry for my mistake that caused wrong answer to be upvoted 8 times and the good one only by me.
kubal5003