Click() works in IE but not Firefox

前端 未结 5 1622
小鲜肉
小鲜肉 2020-12-05 12:08

I have code which is trivial but only works in IE not Firefox.

$(document).ready(function(){
    $(\'li#first\').click();
});

I have also t

5条回答
  •  一整个雨季
    2020-12-05 12:54

    try this html

    click here
    

    js

    $(document).ready(function(){
        $("#link").click(function(){
            window.location.href = $(this).attr('href');
        });
    });
    

    also if this is somethng you don't want to do theb also try something like this:

    $(document).ready(function(){
            $("#link")[0].click();
        });
    

提交回复
热议问题