Two onClick actions one button

前端 未结 4 1285
北海茫月
北海茫月 2020-12-01 14:48

Does someone know a wizards trick to make it work ?



        
4条回答
  •  时光说笑
    2020-12-01 15:12

    Give your button an id something like this:

    
    
    

    Then use jquery (to make this unobtrusive) and attach click action like so:

    
    $(document).ready(function (){
        $('#mybutton').click(function (){
           fbLikeDump();
           WriteCookie();
        });
    });
    

    (this part should be in your .js file too)

    I should have mentioned that you will need the jquery libraries on your page, so right before your closing body tag add these:

    
    
    
    

    The reason to add just before body closing tag is for performance of perceived page loading times

提交回复
热议问题