Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

get element by id and add onlick

HTML

<button id="go-back">Go back!</button>

JavaScript

document.getElementById('go-back').addEventListener('click', () => {
  history.back();
});
 
PREVIOUS NEXT
Tagged: #element #id #add #onlick
ADD COMMENT
Topic
Name
7+8 =