[Answer]-Managing form manipulation by id javascript

1๐Ÿ‘

โœ…

If you have access to jQuery, you could do something along these lines to determine when or if the default selected value has changed:

$(document).ready( function() {
    // Save default select value on page load.
    var default_select = $('#id_open_time_1').val();

    // When it changes, test to see if change is different from default.
    $('#id_open_time_1').change( function() {
        if ( $(this).val() === default_select )
            alert('It has NOT changed! Default is selected.');
        else
            alert('It changed from default!');
    });
});

View example is JSfiddle.

๐Ÿ‘คNostalg.io

Leave a comment