Tuesday, 15 April 2014

javascript - How can I retrieve and display slider range value? -


How can I get and display the slider value from the input range?

I like the Javascript code I'm using meteor.

  & lt; Input id = "slider" type = "range" min = "50" max = "100" step = "10" oninput = "change slider (this.value)" & gt; & Lt; Output ID = "sliderWill" & gt; & Lt; / Product & gt;  

javascript;

  Change the Function Slider (Val) {document.getElementById ('sliderVal'). InnerHTML = val; }  

After referencing it appears that you

  & lt; Template name = "myTemplate">      

client.js

  My.function ()}}} My function () {var val = document.getElementById ("slider") value / / Get an inline value document. GetElementById ('Output'). InnerHTML = val // displays this value on the HTML page console Additionally, you  change  EventType and how to map it. This works when the input changes.  
  Template.yourTemplate.events ({'change input [type] = Range] ': function (event) {var sliderValue = event.currentTarget.value session .set (' sliderValueIs', sliderValue) // Then you can get this session and display it on your page, it is a helpful Can be back in}})  

No comments:

Post a Comment