When exactly the $(document).ready callback is executed?

后端 未结 6 1135
别那么骄傲
别那么骄傲 2021-01-30 19:57

Suppose that we attach a .click() handler to an anchor () tag in the $(document).ready callback. This handler will cancel the default action (following the

6条回答
  •  礼貌的吻别
    2021-01-30 20:19

    For sure it's possible to "cheat" the alert warning (even if the Javascript is enabled). Try to drag the link in the url field and you will see that it will be executed without that warning. This is especially problematic if the link is triggering the delete action.

    About the document.ready callback - I have such problem too. Let me explain. We doing a project where all forms are displaying in popups (jQuery window). So when the popup is closed (for now) the page is reloaded, and I had cases when I am redirected to another screen instead of opening a new popup.

    Totally agree with user384915 about putting javascript directly on the onClick event or even better to href tag.

提交回复
热议问题