Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: The input element's type does not support selection

I'm trying to send a form via AJAX, using jQuery. But I got the error when clicking the submitting button (it is actually a link, but doen't matter).

That's the error in the console:

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

I suspect the problem is that I have some checkboxes there with a multiple selection, and they've been parsed like this:

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

I've tried to stringify them, so it looked like: var logo = JSON.stringify($('input[name=extra]:checked')); but it didn't seem to fix the problem.

What can be the reason or am I doing something wrong?

UPD: jsFiddle here

like image 286
Artem Ushakov Avatar asked Sep 05 '26 14:09

Artem Ushakov


1 Answers

You have to get the value with the val() method:

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

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

like image 143
Adriien M Avatar answered Sep 07 '26 05:09

Adriien M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!