Getting value of select (dropdown) before change

后端 未结 18 2504
无人共我
无人共我 2020-11-22 08:56

The thing I want to achieve is whenever the

Once initialized, 'previousValue' could now be used as an attribute. In JS, to access the previousValue of this select:

$("#mySelect").change(function() {console.log($(this).attr('previousValue'));.....; $(this).attr('previousValue', this.value);}

After you are done using 'previousValue', update the attribute to current value.

提交回复
热议问题