What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-05 12:30:03
javascript canvas grayscale
const img = document.querySelector('img'); const canvas = document.querySelector('canvas'); const ctx = canvas.getContext('2d'); img.onload = function() { canvas.width = img.width; canvas.height = img.height; ctx.filter = 'grayscale(1)'; ctx.draw... Add solution -
Javascript 2022-03-03 03:05:17
display form input on console jquery
var nameInput = document.getElementById('name'); document.querySelector('form.pure-form').addEventListener('submit', function (e) { //prevent the normal submission of the form e.preventDefault(); console.log(nameInput.value); }); Add solution -
Javascript 2022-02-28 11:45:17
get all visible text on website javascript
function isHidden(el) { var style = window.getComputedStyle(el); return ((style.display === 'none') || (style.visibility === 'hidden')) } // get the body tag var body = document.querySelector('body'); // get all tags inside body var allT... Add solution -
Javascript 2022-02-27 15:50:05
js foreach querySelectorAll
const allSpanElements = document.querySelectorAll('span'); allSpanElements.forEach((spanElement) => { // Here comes the Code that should be executed on every Element, e.g. spanElement.innerHTML = "This Content will appear on every span Elemen... Add solution -
Javascript 2022-02-22 21:25:11
iterate over node object children
/* HTML */ /* <ul class="navigation__secondary" id="navigation-bar"> <li class="navigation__secondary-item"> <span>Item</span> </li> <li class="navigation__secondary-item active&... Add solution -
Go 2022-02-22 20:35:03
how to stop google colab from disconnecting
function ConnectButton(){ console.log("Connect pushed"); document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click() } setInterval(ConnectButton,60000); Add solution -
Javascript 2022-02-22 10:20:10
write a javascript code snippet to validate the password textbox length of minimum 8 characters.
function validateInput (textbox) { const inputLength = textbox?.value?.length || 0; if (inputLength < 8) { console.log('Invalid input: minimum 8 chars required'); document.querySelector(`label[for="${textbox.id}"]`).textContent ... Add solution