0

I'm using the jQuery slider to change the value of an input.

div#slider
input#amount

I use the value of the input to perform some math with:

$("input#amount").change(function() {
...

The thing is, when I enter some value in the input, it works fine, but playing with the slider, the value appears to change, but no calculation is performed.

jsfiddle: http://jsfiddle.net/mfeqoL7L/

Why/How to fix this?

Thx!

flintsburg
  • 209
  • 2
  • 11
  • possible duplicate of [Why does the jquery change event not trigger when I set the value of a select using val()?](http://stackoverflow.com/questions/4672505/why-does-the-jquery-change-event-not-trigger-when-i-set-the-value-of-a-select-us) – musically_ut Nov 24 '14 at 19:57

1 Answers1

1

The problem is that setting a value on an input element using .val doesn't fire the change event: Why does the jquery change event not trigger when I set the value of a select using val()?

To manually fire the event call .change explicitly after setting the .val.

Community
  • 1
  • 1
musically_ut
  • 34,028
  • 8
  • 94
  • 106