I am trying to get on/off events for a slider widget in my mobile application. Here is the jsfiddle
var val = 'on';
$('select#flag').change(function() {
if(val!==$(this).val()){
alert($(this).val());
}
val = $(this).val();
});
which works fine but not on my mobile using cordova/phonegap 3.5 and JqueryMobile.
When you bind an event like this it will act as an event delegation. Basically object don't need to exist in a DOM when you execute this binding.
I found my answer here and copied its explanation, it solves my problem getting the event.