开发者

value of textbox has changed or not

开发者 https://www.devze.com 2023-01-04 07:52 出处:网络
how to find whether a value of textbox has changed or not using javascript(even if we copy something and paste it using 开发者_运维问答right click and paste)Try using the textbox onchange eventuse the

how to find whether a value of textbox has changed or not using javascript(even if we copy something and paste it using 开发者_运维问答right click and paste)


Try using the textbox onchange event


use the keyup and click event listeners


Go about something like this:

var elem = document.getElementById('id here');

elem.onchange = function(){
  // your code here......
};

More Info:

http://www.w3schools.com/js/js_events.asp


if you need to check this on separate event and can't use onchange event, you can compare objects defaultValue and value


You can use the onchange event to track if the contents have been changed. It is also possible to compare current input[type=text].value to input[type=text].defaultValue. defaultValue will have the original value supplied in the value-attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号