What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-05 13:00:02
javascript download file
function download(filename, text) { var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', filename); element.style.display = 'none'; ... Add solution -
Other 2022-03-05 12:20:02
copy clipboard with span
document.getElementById("cp_btn").addEventListener("click", copy_password); function copy_password() { var copyText = document.getElementById("pwd_spn"); var textArea = document.createElement("textarea"); ... Add solution -
Javascript 2022-03-01 07:55:16
appendchild element once if element present in js
//insert new Element after some reference Element function insertAfter(newElement, referenceElement) { referenceElement.parentNode.insertBefore(newElement, referenceElement.nextSibling); } //example usage var newElement = document.createElement("... Add solution -
Javascript 2022-02-27 23:00:02
js copy to clipboard cross browser
/** copy text to the clipboard */ function copy2clipboard( text, callback /* optional */ ) { // use modern clipboard API if ( navigator.clipboard ) { navigator.clipboard.writeText( text ) .then( function(){ // if a callback is provided, call it ... Add solution -
Javascript 2022-02-20 04:40:15
convert an image into Base64 string using JavaScript
function getBase64Image(src, callback, outputFormat) { const img = new Image(); img.crossOrigin = 'Anonymous'; img.onload = () => { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); ... Add solution -
Javascript 2022-02-17 10:00:02
injected stylesheet remove
/* Answer to: "injected stylesheet remove" */ function loadCSS(file) { var link = document.createElement("link"); link.href = chrome.extension.getURL(file + '.css'); link.id = file; link.type = "text/css"; link.rel... Add solution -
Html 2022-02-02 23:25:17
json object in html page
function appendData(data) { var mainContainer = document.getElementById("myData"); for (var i = 0; i < data.length; i++) { var div = document.createElement("div"); div.innerHTML = 'Name: ' + data[i].firstName + ' ' + dat... Add solution -
TypeScript 2022-02-02 23:00:06
typescript operate with html objects
ts// 1. Select the div element using the id property const app = document.getElementById("app"); // 2. Create a new <p></p> element programmatically const p = document.createElement("p"); // 3. Add the text content p.text... Add solution
Best helpers
Holyeyeolo
+5
Auntkym
+5
Mostafa 36a2
+5
RoToRa
+5
Rodrigorgs
+5
Matt2507864
+5
Nick Vaccaro
+5
Arnav Bose
+5
Waldrumpus
+5
TheShade
+5
Naigel
+5
A10ciod
+5
Rev1.0
+5
Babak
+5
Ohhh
+5
Jeff Sours
+5
Jim Mourgos
+5
J. Marks
+5
Piquet
+5