fredag den 23. marts 2012

Bind input type range change event

Took me forever to find out how to bind the input type="range" element's change-handler in JQuery. This is what I came up with, which works for me with JQuery 1.6.4:

  $(document).ready(function () {

  $('[type=range]').each(function () {

                $("#" + $(this).attr("id")).bind("change", function (event, ui) {
                    alert(event.target.value);
                });
            });

});

Hope this helps somebody.

Ingen kommentarer:

Tilføj en kommentar