skip to Main Content

Javascript – How can I add form validation with js?

form.addEventListener('submit',(event)=>{ event.preventDefault() const input=[nameinput,desc,number]; if(nameinput.value.trim() && desc.value.trim() && number.value.trim()){ let obj = { name: nameinput.value, desc: desc.value, price: number.value } axios.post("http://localhost:3000/Pulse", obj) .then(res => { window.location = "./index.html" }) } }) How can I add form validation with javascript? required.…

VIEW QUESTION
Back To Top
Search