How to set onclick with javascript?

前端 未结 4 587
萌比男神i
萌比男神i 2021-02-05 07:20

I am trying to set the onclick event using javascript. The following code works:

var link = document.createElement(\'a\');
link.setAttribute(\'href\', \"#\");
l         


        
4条回答
提交回复
热议问题