vlio20
vlio20

Reputation: 9305

range input change event not fires

I am using jquery and jquery mobile to catch a change event. I am using this html and jquery code:

html:

<input type="range" name="someName" min="0" max="10"/>

jquery:

$('input[type="range"]').change(function(){
    alert('asdasd');
});

when I change the input attribute to name it works fine. Like this:

$('input[name="range"]').change(function(){
        alert('asdasd');
});

I don't know why the event is not being cached. Thanks

Upvotes: 0

Views: 3031

Answers (3)

user873792
user873792

Reputation: 323

'input[type="range"]' don't trigger change when Emulate touch screen is true on then Chrome

Upvotes: 0

Gajotres
Gajotres

Reputation: 57309

Don't use change event, use slidestart or slidestop.

More info: http://jquerymobile.com/test/docs/forms/slider/events.html

Here's an example I have created few days ago: http://jsfiddle.net/Gajotres/PzTeX/

$("input#europe, input#us, input#uk, input#japan").live("slidestop", function() {

});

Upvotes: 1

Tim Joyce
Tim Joyce

Reputation: 4517

Looks good to me. Maybe you are calling the jquery before the element is loaded. Is it wrapped in document.ready? Are you using a non-html5 browser?

$(function(){
    $('input[type="range"]').change(function(){
        alert('asdasd');
    });
});

Upvotes: 0

Related Questions