How to simulate anchor link click

前端 未结 6 688
渐次进展
渐次进展 2020-12-15 04:02

I\'m trying to trigger a link click for .jquery. Does someone know why the following doesn\'t work.



        
6条回答
  •  难免孤独
    2020-12-15 04:29

    Looks like your $("google_link_proxy") selector is off. Try $("#google_link_proxy").

    You also need to close the observe call with }).

    Those are the syntax errors with the code above though I don't think those functions are provided in jQuery by default.

    Here is what I think you're after:

    $("#google_link_proxy").click(function(event){
        window.open($("#google_link").attr('href'),'_blank')
    });
    

提交回复
热议问题