$('a').trigger('click'); not working

后端 未结 9 2405
南旧
南旧 2021-02-19 04:06

How do I make jquery click test



        
9条回答
  •  一生所求
    2021-02-19 04:51

    use the following way.... since you want to download the file prevent the link from navigating.

    $(document).ready(function() {
        $('#mylink').click(function(e) {
           e.preventDefault();  //stop the browser navigating
           window.location.href = 'test.zip';
        });
    }); 
    

提交回复
热议问题