How can I prevent [removed] from being triggered by [removed] href links in IE?

前端 未结 6 1668
清酒与你
清酒与你 2021-01-30 05:24

I\'m building a fail safe for my form that is going to warn users that if they leave the page their form data will be lost (similar to what gmail does).

window.         


        
6条回答
  •  面向向阳花
    2021-01-30 06:03

    Move any script to a click event handler instead, with a fallback page for users without JavaScript:

    click
    

    The unobtrusive JS champions out there will probably object to the use of the onclick attribute, but the fact is that it works, it's the simplest way to add an event handler and the simplest way to provide an example. For better separation of concerns, you could instead use either a DOM0 onclick property, addEventListener() / attachEvent() or a library.

提交回复
热议问题