javascript - Getting value of text field with array type name using jQuery - Stack Overflow

I have an input text field like below<input type="checkbox" value="9961103777" n

I have an input text field like below

<input type="checkbox" value="9961103777" name="mobile[]">

I just want to get the value using jquery. I tried this but not working:

jQuery('input[name=mobile[]]');

Please help me in this.

I have an input text field like below

<input type="checkbox" value="9961103777" name="mobile[]">

I just want to get the value using jquery. I tried this but not working:

jQuery('input[name=mobile[]]');

Please help me in this.

Share Improve this question edited Feb 20, 2014 at 8:07 Chen-Tsu Lin 23.3k16 gold badges56 silver badges65 bronze badges asked Feb 20, 2014 at 7:52 akhil n lakhil n l 1812 silver badges10 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 3

You can use val() as well as wrapping the name of your input inside double quotes " ":

jQuery('input[name="mobile[]"]').val()

Put attribute value in quotes. To fetch its value use .val()

jQuery('input[name="mobile[]"]')

DEMO

try

$("input[name='mobile[]']").val();

try this ..

Refer this post Jquery get input array field

$('input[name^="mobile"]').each(function() {
    alert($(this).val());
});

JS Fiddle Example

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745489883a4629940.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信