What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-08-31 09:01:02
javascript check if dom element exists
var element = document.getElementById("test"); //If it isn't "undefined" and it isn't "null", then it exists. if(typeof(element) != 'undefined' && element != null){ alert('Element exists'); } else{ alert('Ele... Add solution -
Javascript 2021-08-31 08:30:03
how to get all scripts on a page javascript
var scripts = document.getElementsByTagName("script"); for (var i = 0; i < scripts.length; i++) { if (scripts[i].src) { console.log(i, scripts[i].src); } else { console.log(i, scripts[i].innerHTML); } Add solution -
C 2021-08-31 06:11:01
how can i show ant text by onclick
<!DOCTYPE html> <html> <body> <h2>Displaying text when clicked</h2> <button type="button" onclick="document.getElementById('demo').innerHTML = 'These are the steps to get your PIN number: Bla bla bla'"... Add solution -
Javascript 2021-08-31 05:14:02
change iframe src by javascript
// so you got an iframe (id="myiframe"). In that page you have an element id="theprice" and you want to change its value // from the parent page do this in your javascript: var iframevar = document.getElementById('myiframe'); var elmnt... Add solution -
Javascript 2021-08-30 22:38:03
javascript password matching
let pass1 = document.getElementById("pass-one"); let pass2 = document.getElementById("pass-two"); let run = document.getElementById("run"); run.addEventListener("click", function () { if (pa... Add solution -
Javascript 2021-08-30 17:41:01
apply css media query using js
function myFunction(x) { if (x.matches) { // If media query matches document.body.style.backgroundColor = "yellow"; } else { document.body.style.backgroundColor = "pink"; } } var x = window.matchMedia("(max-width: 7... Add solution