1 select获取改变之前的值
- var previous;
- $("select").focus(function () {
- // Store the current value on focus, before it changes
- previous = this.value;
- }).change(function() {
- // Do something with the previous value after the change
- alert(previous);
- });
2 javascript保留两位小数
- parseFloat(num).toFixed(2);
- //or
- Math.round(num * 100) / 100