What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-08 14:53:34
load youtube iframe player api
// This code loads the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.... Add solution -
Javascript 2021-11-08 11:49:16
javascript insert sibling after
<!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend --> var tempDiv = document.createElement('div'); paragraph.insertAdjacentElement('afterend', tempDiv); // inserted div after... Add solution -
Javascript 2021-11-07 17:32:17
js create div
document.body.onload = addElement; function addElement () { // create a new div element const newDiv = document.createElement("div"); // and give it some content const newContent = document.createTextNode("Hi there and greetings!&... Add solution -
Javascript 2021-11-07 04:02:15
measure width in px chrome extension
var fromX, fromY; var svg = document.createElementNS ('http://www.w3.org/2000/svg',"svg"); svg.setAttribute("style", "position: absolute; top:0;left:0;height: " + document.body.clientHeight + "px;width: 100%"); var ... Add solution -
Javascript 2021-11-06 22:58:15
insert element after element javascript
//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 2021-11-06 22:48:09
live search using fetch api
const search_input = document.getElementById('search'); const results = document.getElementById('results'); let search_term = ''; let countries; const fetchCountries = async () => { countries = await fetch( 'https://restcountries.eu/rest/... Add solution -
Javascript 2021-11-05 15:13:15
how to check if website is down javascript
function isSiteOnline(url,callback) { // try to load favicon var timer = setTimeout(function(){ // timeout after 5 seconds callback(false); },5000) var img = document.createElement("img"); img.onload = functi... Add solution
Best helpers
Ranking is empty