开发者

jquery find method

I have a function called using an anchor inside a form, and I need to get the values of the inputs inside the same form to perform certain actions. Problem is, the result is always undefined.

Here's the code :

$('#create_alert').live('click', function(e) {
    var form = $(this).parent().get(0);

    var id = $(form).find('input[name="id"]').val();

    alert(id);
});

.. and the context :

<form name="create_alert">
<input type="hidden" name="id" value="1" />
<a href="#" type="text" id="create_alert" class="search-submit">CRIAR ALERTA</a>
</form>开发者_JAVA百科;

Thoughts?


For me it alerts "1": http://jsfiddle.net/cyD4P/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜