0

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.

Chen-Tsu Lin
  • 22,876
  • 16
  • 53
  • 63
akhil n l
  • 181
  • 2
  • 10

4 Answers4

3

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

jQuery('input[name="mobile[]"]').val()
Felix
  • 37,892
  • 8
  • 43
  • 55
1

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

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

DEMO

Satpal
  • 132,252
  • 13
  • 159
  • 168
1

try

$("input[name='mobile[]']").val();
Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53
0

try this ..

Refer this post Jquery get input array field

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

JS Fiddle Example

Community
  • 1
  • 1
Kapil
  • 1,823
  • 6
  • 25
  • 47