admin管理员组文章数量:1389903
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
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
Share Improve this question edited Sep 8, 2014 at 9:40 Artem Ushakov asked Sep 8, 2014 at 9:15 Artem UshakovArtem Ushakov 3132 silver badges13 bronze badges 5- Since you activate the form submission by clicking on a link, I assume that you handle the form submission with javascript... Care to share that piece of code here so we can help you? – Loupax Commented Sep 8, 2014 at 9:26
- jsfiddle would help here – artm Commented Sep 8, 2014 at 9:28
- You are getting a list of elements, I suspect you want to get their values. – Rob Schmuecker Commented Sep 8, 2014 at 9:35
- And that's my link – Artem Ushakov Commented Sep 8, 2014 at 9:39
-
var word1 = $('input[name=line1]:checked').val();
? – Arun P Johny Commented Sep 8, 2014 at 9:45
2 Answers
Reset to default 5You have to get the value with the val() method:
$('input[name="line1"]:checked').val()
I updated your snippet here: http://jsfiddle/4mxsvch3/2/
Try this
$('input[name="extra"]').is(":checked");
本文标签: javascriptjQuery The input element39s type does not support selectionStack Overflow
版权声明:本文标题:javascript - jQuery: The input element's type does not support selection - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744602470a2615149.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论