javascript - Using polyfill for input type 'range' in IE9 -


i'm trying use html5 input type 'range'. not supported in ie8 & ie9 , replaced input type 'text'. make field work i'm using polyfill input type 'range'. polyfill i'm using is: rangeslider.js (http://andreruffert.github.io/rangeslider.js/)

the html of inputfield looks this:

<input type="range" id="somefield" name="somefield" required="required" min="0" max="100" step="1" class="classname"  value="10"> 

the javascript runs polyfill called on input[type="range"]. example:

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

somehow polyfill works correctly if call on input element, , not on element class. calling below not work (it render, value of range not stored in input element):

$('.classname').rangeslider(); 

however, ie replaces input in dom following html:

<input name="somefield" class="classname" id="somefield" required="required" type="text" min="0" max="100" step="1" value="10"> 

because input element has different input type, selector $('input[type="range"]') not work. using class or id selector doesn't seem work (in case polyfill doesn't update value of original element)

in other browsers (firefox, chrome) polyfill seem work (when let override native support).

question: how use polyfill (with element selector) in ie9?

i found mistake. possible use class selector. here piece of code calls polyfills multiple range input fields. avoids using input type selector , seems work in browsers. works multiple fields on 1 page.

    $('input.classname').each(function(e) {       $(this).rangeslider();     }); 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -