What do you want to save?
Add Code snippet
New code examples
-
Html 2021-11-19 01:43:08
how to make a to-do list in html
<!DOCTYPE html> <html> <head> <title>To-Do List App</title> <script> function addItem() { var newItem = document.createElement("div"); newItem.innerHTML = document.getElementById("box").va... Add solution -
Javascript 2021-11-18 15:23:20
how to make a button do different functions on different clicks
<button id="clickme">Click Me</button> <script> function one() { alert('one clicked'); document.getElementById('clickme').onclick = two; } function two() { alert('two clicked'); } document.getElementByI... Add solution -
Javascript 2021-11-16 00:39:18
legend on click use default chartjs
// How to implement a custom behaviour when clicking on a legend element var original = Chart.defaults.global.legend.onClick; Chart.defaults.global.legend.onClick = function(e, legendItem) { /* do custom stuff here */ original.call(this, e, legendItem... Add solution -
Javascript 2021-11-14 14:13:21
javascript counting when clicking a button
var myButton = document.getElementById("my-button"); //Getting the button with "my-button" as id. var myOutput = document.getElementById("my-output"); //Getting the id for the tag where you want to output your number var star... Add solution -
Javascript 2021-11-11 08:22:11
useRef example
/* A common use case is to access a child imperatively: */ function TextInputWithFocusButton() { const inputEl = useRef(null); const onButtonClick = () => { // `current` points to the mounted text input element inputEl.current.focus(); ... Add solution -
Javascript 2021-11-11 01:53:15
var notification = new Notification
// request permission on page load document.addEventListener('DOMContentLoaded', function() { if (!Notification) { alert('Desktop notifications not available in your browser. Try Chromium.'); return; } if (Notification.permission !== 'granted') ... Add solution -
Javascript 2021-11-10 16:07:18
react enzyme simulate click sub component
// App.js function App() { const [count, setCount] = React.useState(0) const onClick = () => { setCount((prevState) => prevState + 1) } return ( <div> <button onClick={onClick}>{count}</button> </div&... Add solution
Best helpers
Ranking is empty