+ 1

help!

is there any method to make a button clicked rather than calling a function for each button? i had try the following code but doesnt work if(document.getElementById("button1"). clicked == true){ alert("bla, bla, bla"); }

3rd May 2017, 10:52 PM
boyd
boyd - avatar
4 Réponses
+ 4
<button id="btn" onclick={alert ("bla,bla,bla")}>button1</button> // other elements can call onclick() or click () to trigger the button event. Some browsers use onclick, some use click functions var btn = document.getElementById('btn'); if(typeof btn.click == 'function') btn.click() else if(typeof btn.onclick == 'function') btn.onclick() Try and tell us the code is work for you or not. :)
3rd May 2017, 11:12 PM
Calviղ
Calviղ - avatar
0
onclick is very easy with function and window.onclick='' or write in google w3school onclick function
4th May 2017, 6:10 AM
Mi Camino Es Boxeador Profesional = Jhon / Tux
Mi Camino Es Boxeador Profesional = Jhon / Tux - avatar
0
beacause is bad onclick in html is better in pure.js
4th May 2017, 6:11 AM
Mi Camino Es Boxeador Profesional = Jhon / Tux
Mi Camino Es Boxeador Profesional = Jhon / Tux - avatar
4th May 2017, 6:16 AM
Mi Camino Es Boxeador Profesional = Jhon / Tux
Mi Camino Es Boxeador Profesional = Jhon / Tux - avatar