1

I'm trying to set it so that the value is shown next to my range slider, but I can't seem to get it to work.

I have looked at this and this but because I am working with HAML which I cam quite new at, I can't seem to get it to work.

The code I have at the moment is:

.form-object
 = f.label :duration, 'TEST DURATION', :class => 'form-label'
 .col-sm-10
  = f.range_field :duration, :class => 'slider', in: 1...100, :onchange => 'showValue(this.value)'
 %span#time 60

:javascript
  function showValue(newValue) {
    document.getElementById('time').innerHTML = newValue;
  }

But the %span doesn't show up, even in the generated HTML. I tried it with %output as well but there was no difference...

Any ideas?

Community
  • 1
  • 1
camillavk
  • 521
  • 5
  • 20

0 Answers0