Sup Sup Forums, do any of you know javascript?

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.

Other urls found in this thread:

w3schools.com/js/js_whereto.asp
utf-8.jp/public/aaencode.html
utf-8.jp/public/jjencode.html
twitter.com/AnonBabble

***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?