What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-05 18:45:05
vanilla js for each element add attribute
const linksArray = Array.from(document.querySelectorAll('section a')); // we use Array.from to transform the NodeList from querySelectorAll to an array. Needs to IE11 linksArray.forEach(linkEl => { // we search for every span and em inside the link l... Add solution -
Javascript 2021-10-03 20:16:04
queryselectorall
//To obtain a NodeList of all of the <p> elements in the document: const matches = document.querySelectorAll("p"); //This example returns a list of all <div> elements within the document with a class of either note or alert: const m... Add solution -
Javascript 2021-10-02 07:02:02
how to make input field empty in javascript
const inputFeilds = document.querySelectorAll("input"); const validInputs = Array.from(inputFeilds).filter( input => input.value !== ""); console.log(validInputs) //[array with valid inputs] Add solution -
Html 2021-09-30 03:35:02
dynamic checkbox list in html
const DynamicCheckboxes = { checkboxes: document.querySelectorAll('.table td input[type="checkbox"]'), selectAllTarget: document.querySelector('.js-select-all'), clearBtn: document.querySelector('.js-clear'), initialize() { this.sh... Add solution -
Javascript 2021-09-27 20:45:02
js copy paragraph onclick
var copy = document.querySelectorAll(".copy"); for (const copied of copy) { copied.onclick = function() { document.execCommand("copy"); }; copied.addEventListener("copy", function(event) { event.preventD... Add solution