Find the code below to prevent the Select box/Dropbox to alter the value if 'NO' to Confirm using Jquery.
var prev_rank_val; $( '#rank_level_id' ).focus(function() { prev_rank_val = $(this).val(); }) .change(function() { $(this).blur() // Firefox fix var msg = "Are you sure you want to continue?"; // message here var action = confirm(msg); if ( action==true) { return true; } else { $(this).val(prev_val); // rollback the current value if to No return false; } });
No comments:
Post a Comment
Please post any queries and comments here.