sup Sup Forums, do any of you know javascript?
I'm trying to make an html button trigger a javascript function but it's not working and I don't get why.
Sup Sup Forums, do any of you know javascript?
Other urls found in this thread:
w3schools.com
utf-8.jp
utf-8.jp
twitter.com
***jquery is also acceptable
document.querySelector("#mybutton").addEventListener("click", function(){
// doSomething();
});
...
OP is a fag
function doShit(parameters)
{
//do shit here
}
poke me like you poke dick OP
The fucks up with the href="javascript:null;" thing?
also why are you using querySelector for something that has an ID? Use getElementById
>open the console
>fuck off
You can either have an onclick event that links to the function on the button
or add in an event listener
var btn = document.getElementById("button");
btn.addEventListener("click", function());
>typical JavaScript devs
If I were your boss and you show me a code like that, you'll be fired on the spot .
How would you do it then, boss?