pencilCake pencilCake - 2 years ago 104
Javascript Question

How can I check if a value is changed on blur event?

Basically I need to check if the value is changed in a textbox on the 'blur' event so that if the value is not changed, I want to cancel the blur event.

If it possible to check it the value is changed by user on the blur event of an input HTML element?


Answer Source

I don't think there is a native way to do this. What I would do is, add a function to the focus event that saves the current value into a variable attached to the element (element.oldValue = element.value). You could check against that value onBLur.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download