What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-13 20:28:03
js paste event
const target = document.querySelector('div.target'); target.addEventListener('paste', (event) => { let paste = (event.clipboardData || window.clipboardData).getData('text'); paste = paste.toUpperCase(); const selection = window.getSelect... Add solution -
Javascript 2021-10-12 01:38:08
crop image javascript
Here is a function to get the image as you are uploading using the choose file button function readURL() { const myimg = document.getElementById("myimg"); const input = document.getElementById("myfile"); if(input.files &am... Add solution -
Other 2021-10-12 00:35:04
background image load defer
function init() { var imgDefer = document.querySelectorAll('div[data-src]'); var style = "background-image: url({url})"; for (var i = 0; i < imgDefer.length; i++) { imgDefer[i].setAttribute('style', style.replace("{url}",... Add solution -
Javascript 2021-10-12 00:16:07
js then vs await
async function fancyShowRainbow(){ const response = await fetch("rainbow.jpg"); const blob = await response.blob(); document.querySelector(".my-image").src = URL.createObjectURL(blob); } function showRainbow(){ fetch("... Add solution
Best helpers
Ranking is empty