go to link on button click - jquery

前端 未结 5 1741
情书的邮戳
情书的邮戳 2021-01-31 17:41

I have a script as below

$(\'.button1\').click(function() {
    document.location.href=$(this).attr(\'id\');
});

the button1 has variable uniqu

5条回答
  •  无人共我
    2021-01-31 18:13

    You need to specify the domain:

     $('.button1').click(function() {
       window.location = 'www.example.com/index.php?id=' + this.id;
     });
    

提交回复
热议问题