andreruffert / rangeslider.js

🎚 HTML5 input range slider element jQuery polyfill
https://rangeslider.js.org
MIT License
2.16k stars 401 forks source link

Change example on http://andreruffert.github.io/rangeslider.js/ to use data-selector instead of input selector #145

Closed neilbaylorrulez closed 8 years ago

neilbaylorrulez commented 9 years ago

This selector

$('input[type="range"]').rangeslider();

fails in IE8 and 9

I think you should update your example usage to use a data-selector like:

$('[data-range]').rangeslider();
<input type="range" data-range>

So that your example usage works out of the box in IE8 and 9

Thanks!

andreruffert commented 9 years ago

Thanks for reporting but I'm not sure what you mean so far... It shouldn't be a problem to use a $('input[type="range"]') selector also in IE8 or IE9.

Tested this CodePen on IE8 Windows XP without any issues.

bildschirmfoto 2015-04-21 um 22 44 24

neilbaylorrulez commented 9 years ago

Ahh, you're right.

The issue comes up when you programatically add the input (with innerHTML or appendChlid) When doing it this way, the IE parser strips the type="range" which will make the subsequent selector fail.

So it might still be good advice to use a data attribute (or a class) as the selector in your example usage - it would have saved me 5 minutes atleast :P

andreruffert commented 8 years ago

✅