What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-03 19:08:02
mozilla observer onclick
var observeDOM = (function(){ var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; return function( obj, callback ){ if( !obj || obj.nodeType !== 1 ) return; if( MutationObserver ){ // define a new observer... Add solution -
Javascript 2021-09-30 02:12:04
event bubbling in javascript
<script> form.onclick = function(event) { event.target.style.backgroundColor = 'yellow'; // chrome needs some time to paint yellow setTimeout(() => { alert("target = " + event.target.tagName + ", this=" + this.tagN... Add solution -
Javascript 2021-09-28 19:26:04
javascript document.createElement add function
var newTH = document.createElement('th'); newTH.innerHTML = 'Hello, World!'; newTH.onclick = function () { this.parentElement.removeChild(this); }; var table = document.getElementById('content'); table.appendChild(newTH); Add solution -
Javascript 2021-09-28 10:36:06
how to get values from select multiple in js
document.getElementById('submit').onclick = function() { var selected = []; for (var option of document.getElementById('pets').options) { if (option.selected) { selected.p... 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 -
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
Best helpers
Ranking is empty