What do you want to save?
Add Code snippet
New code examples
-
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 -
Javascript 2021-09-25 22:47:03
build a trivia and answer javascript
// code by webdevtrick (https://webdevtrick.com) function Quiz(questions) { this.score = 0; this.questions = questions; this.questionIndex = 0; } Quiz.prototype.getQuestionInde... Add solution -
Javascript 2021-09-21 22:42:02
Playcanvas on button click
var ReportSystem = pc.createScript('reportsystem'); ReportSystem.attributes.add('entity',{type:'entity'}); ReportSystem.prototype.initialize = function() { var rs = this.entity.findByName('rsBTN'); rs.element.on('mouseup', this.onClick, this); }... Add solution -
Javascript 2021-09-12 02:38:03
how to create dynamic onclick event in javascript
/* This example assumes you have two elements with an id attribute of 'cats' and 'dogs'. */ const conditionOneHandler = event => { alert('I like cats!'); } const conditionTwoHandler = event => { alert('I like dogs!'); } const clickHand... Add solution -
Javascript 2021-09-08 13:50:02
how to add class to element on mouseclick with js
// element.classList.add("newClass"); // or // element.className += "newClass"; // Example document.querySelector("button").onclick = function addNewClass() { document.querySelector(".elementToChange").classList... Add solution
Best helpers
Ranking is empty