JQuery: Input element type does not support selection

I am trying to submit a form via AJAX using jQuery. But I got an error when I clicked the submit button (it's actually a link, but doesn't matter).

What's the error in the console:

Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element type ('checkbox') does not support selection.

      

I suspect the problem is that I have some multiple choice checkboxes and they were parsed like this:

var logo = $('input[name=extra]:checked');

      

I tried to align them, so it looked like this var logo = JSON.stringify($('input[name=extra]:checked'));

, but it seems the problem persists.

What could be the cause or am I doing something wrong?

UPD: jsFiddle here

+3


source to share


2 answers


You should get the value using the val () method :

$('input[name="line1"]:checked').val()

      



I've updated your snippet here: http://jsfiddle.net/4mxsvch3/2/

+5


source


try it



  $('input[name="extra"]').is(":checked");

      

0


source







All Articles