js eventlistener to add and remove stylings
const form = document.querySelector('form');
const fname = document.getElementById('fname');
const lname = document.getElementById('lname');
const para = document.querySelector('p');
form.onsubmit = function(e) {
if (fname.value === '' || lname.value === '') {
e.preventDefault();
para.textContent = 'You need to fill in both names!';
}
}
Also in JavaScript:
- react interactions
- how to create server.js file
- javscript append item from array
- merge objects javascript
- node sleep
- refresh div jquery
- for key value in object javascript
- validate email jquery
- vue watch deep property
- how to make back button react
- javascript match
- how to declare 3d array in javascript
- js split string every n characters
- array definition js
- split a message js
- how to make an express server
- set element at index javascript array and create new array
- convert java object to json
- javascript game loop
- show ad on facebook game
- conditional great chart js
- css div at bottom of div
- kendo dropdownlist value jquery
- javascript check if boolean is undefined