admin管理员组文章数量:1356585
Hello I got a rather simple question. I use the HTML5 range slider type: <input type="range">
and I want to trigger it via jQuery.
I used the following code:
$("form input:range").each(function () {
// Do something
});
For some reason I get the following error:
! Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: range
Perhaps important: I use jquery-1.12.1.min.js.
Does anyone now why this is and how I could solve this?
Hello I got a rather simple question. I use the HTML5 range slider type: <input type="range">
and I want to trigger it via jQuery.
I used the following code:
$("form input:range").each(function () {
// Do something
});
For some reason I get the following error:
! Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: range
Perhaps important: I use jquery-1.12.1.min.js.
Does anyone now why this is and how I could solve this?
Share Improve this question edited May 31, 2016 at 8:30 Pranav C Balan 115k25 gold badges171 silver badges195 bronze badges asked May 31, 2016 at 8:23 Rotan075Rotan075 2,6155 gold badges37 silver badges56 bronze badges 2-
1
The error states the exact issue, there is no
:range
selector in jQuery. – Rory McCrossan Commented May 31, 2016 at 8:25 - Please read this post: stackoverflow./questions/10004723/… – d.danailov Commented May 31, 2016 at 8:33
3 Answers
Reset to default 6Try this:
jQuery("input[type=range]")
:
is for getting some kind of meta information, usually related to what the user is doing with the element.
For example: :hover
only applies to elements the user has placed the cursor over and :visible
is elements the user can see.
EDIT
Pranav C Balan's answer better explains what is going on: HTML5 range - unsupported pseudo: range
There is no :range
pseudo selector in css or jQuery. Instead you can use attribute equals selector
$("form input[type='range']").each(function () {
// Do something
});
For all supported selectors list visit : JQuery Selectors
Yes, you need to use attribute equals selector:
jQuery("input[type=range]")
There's use of :in-range or :out-of-range css selector that you can use for min and max value range:
$("form input:in-range").each(function () {
// Do something
});
But alas! There's no :range
selector.
本文标签: javascriptHTML5 rangeunsupported pseudo rangeStack Overflow
版权声明:本文标题:javascript - HTML5 range - unsupported pseudo: range - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744067659a2585301.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论