What do you want to save?
Add Code snippet
New code examples
-
Html 2021-11-07 06:35:19
javascript get value of input on button click
<form action="/"> <label for="">Whatever you want</label> <input type="text" id='form'> <input type="submit" id="submit"> </form> <script> const btn = doc... Add solution -
Html 2021-11-02 22:01:06
scroll to top smooth safari
<!--Example of a button to scroll to top, Remember to use the same id on both the button and the function --> <button id='myBtn' > Click me to go to top! </button> <!-- When the user clicks on the button, scroll to the top ... Add solution -
Javascript 2021-10-30 08:40:21
input text react 2020
function LoginForm() { const [email, setEmail] = React.useState(""); const [password, setPassword] = React.useState(""); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); api.login(email, password); ... Add solution -
Javascript 2021-10-28 02:35:13
prevent default on enter press
/* Jquery method */ $('#form-input').on('keypress', (e) => { const keyPressed = e.keyCode || e.which; if (keyPressed === 13) { e.preventDefault(); return false; } /* or */ return keyPressed !== 13; }); /* or */ $('#form-input').on... Add solution -
Javascript 2021-10-27 23:41:10
uncontrolled components reactjs interview questions
function FormValidation(props) { let inputValue = React.createRef(); let handleSubmit = e => { alert(`Input value: ${inputValue.current.value}`); e.preventDefault(); }; return ( <div> <form onSubmit={handleSubmit}> ... Add solution