Animations

API

Arrays

Async

Basics

Challenges

Classes

Console

Dates

Debugging

DOM Elements

DOM Methods

DOM Navigation

DOM Properties

Event Listeners

Flow Control

Forms

Functions

Global Functions

JSON

Keywords

Libraries (3rd party)

Math

Modules

Objects

Snippets

String

Types

Widgets

Window Object

JavaScript - OnClick vs Click

When adding and event using addEventListener(), you do not use the "on" prefix. When doing it inline, right in the mark up as an property, you do use "on" as well as attaching it to an object like object.on{event}.


document.getElementById("TestButton").addEventListener("click", function(){ SayHello()});
// vs
<button type="button" id="GoodbyeButton" class="btn btn-danger" onclick="SayGoodBye()">Say Goodbye</button>