admin管理员组

文章数量:1427140

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

本文标签: javascriptGetting value of text field with array type name using jQueryStack Overflow