Calling jQuery method from onClick attribute in HTML

前端 未结 5 1279
半阙折子戏
半阙折子戏 2020-12-14 16:45

I am relatively new to implementing JQuery throughout an entire system, and I am enjoying the opportunity.

I have come across one issue I would love to find the corr

5条回答
  •  暖寄归人
    2020-12-14 17:18

    I don't think there's any reason to add this function to JQuery's namespace. Why not just define the method by itself:

    function showMessage(msg) {
       alert(msg);
    };
    
    
    

    UPDATE: With a small change to how your method is defined I can get it to work:

    
    
     
     
    
    
     
    Welcome!

提交回复
热议问题