开发者

Comparing screen data at client side

Is there any way I can check whether the user has changed any data on the web page between the page load and sav开发者_如何学JAVAe button click. If the user has opened any page to edit some data and clicks the save button without changing any data on the screen then I need to display a message.

Thanks in advance.


I think setting a flag would be a good idea. Use global selectors to do such a thing.

var changed = false;
$("input").change(function(){
    //something changed
    changed = true;
});

Then if the users leaves the page, check if changed is true


I think what you are trying to do is check if the form is dirty (i.E. something has changed) and this dirty form plugin might help you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜