and I wan...">

HTML5 Range - Unsupported Pseudo: Range

Hi, I have a pretty simple question. I am using the HTML5 range slider type: <input type="range"> and I want to run it through jQuery.

I used the following code:

 $("form input:range").each(function () { // Do something }); 

For some reason, I get the following error:

! Error on failure: syntax error, unrecognized expression: unsupported pseudo: range

Perhaps important: I'm using jquery-1.12.1.min.js .

Anyone now why this is so and how can I solve it?

+5
source share
3 answers

Try the following:

 jQuery("input[type=range]") 

: designed to receive some kind of meta-information, usually related to what the user is doing with the element.

For example:: :hover applies only to elements on which the user has placed the cursor, and :visible are elements that the user can see.

EDIT

Pranav C Balan's answer better explains what happens: HTML5 range - unsupported pseudo: range

+6
source

There is no pseudo selector in css or jQuery :range . Instead, you can use the attribute equal to the selector

 $("form input[type='range']").each(function () { // Do something }); 

For all supported selectors, select: JQuery selectors

+5
source

Yes, you need to use an attribute selector:

 jQuery("input[type=range]") 

It uses : in-range or : out-of-range css, which you can use for the range of minimum and maximum values:

 $("form input:in-range").each(function () { // Do something }); 

But alas! No selector :range .

+1
source

All Articles