Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

button in vanilla js

let newButton = document.createElement('button');
newButton.setAttribute("id", "myNewButton");
newButton.className = "myClassName";
newButton.innerText = "clickMe";
newButton.addEventListener("click", clickMe);
document.body.appendChild(newButton);
function clickMe(){
    console.log("Hi! I  am a new Button.");
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: simple reactjs login form 
Javascript :: remove double slash from url javascript 
Javascript :: javascript check if array has duplicates 
Javascript :: prevent a page from refreshing in react 
Javascript :: jQuery on right mouse click 
Javascript :: react fetch url 
Javascript :: javascript include js file 
Javascript :: drupal 8 check if current page is node 
Javascript :: html javascript type 
Javascript :: get value of hidden field jquery 
Javascript :: regex for check if string is only empty or whitespace javascript 
Javascript :: add class when element in viewport vanilla javascript 
Javascript :: react-native-permissions could not be found within the project or in these directories: 
Javascript :: chartjs hide text inside bar 
Javascript :: js write and get cookie 
Javascript :: json with multiple objects 
Javascript :: 3 = signs in javasdcript 
Javascript :: get first object key javascript 
Javascript :: how to use secondary color in material ui useStyle 
Javascript :: jquery move element to another without losing events 
Javascript :: base 64 in js 
Javascript :: js array fill map 
Javascript :: react useeffect async javascript 
Javascript :: json to list flutter 
Javascript :: js getelementbyid 
Javascript :: sweetalert close on custom button click 
Javascript :: javascript remove single class from element 
Javascript :: vue event focus out 
Javascript :: find the index of an object in an array 
Javascript :: jquery loop through collection backwards 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =