Add event to button with javascript

后端 未结 4 1261
忘掉有多难
忘掉有多难 2020-12-18 23:24

In this page there\'s a way to dynamic add html (textbox,input button and radio elements with javascript

my questioon is how can i add an event to the button, imagi

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-18 23:51

    var element = document.createElement("input");
    element.onclick = function() {alert('Clicked!');};
    

提交回复
热议问题