📜  取消下拉列表 onchange 事件 javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:07.043000             🧑  作者: Mango

代码示例1
$("#country").change(function() {
  var newVal = $(this).val();
  if (!confirm("Are you sure you wish to destroy these country branches?")) {
    $(this).val($.data(this, 'val')); //set back
    return;                           //abort!
  }
  //destroy branches
  $.data(this, 'val', newVal);        //store new value for next time
});