且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从< select>获取更改的值使用jQuery

更新时间:2023-01-28 12:54:24

做到这一点:

var valueBeforeChange = $('select[name="inputUserRoles[]"]').val();

$('select[name="inputUserRoles[]"]').change(function(e) {
  var inputUserRoles = $(this).val();

  //you can compare here with value before change
  ...

  valueBeforeChange = inputUserRoles;
});