Message from JavaScript discussions

July 2019

— Which is what you wanted?


I have to validate the form data when the button clicks.but the form validation runs o'clock the button but the page reload suddenly

— I have to prevent that

— And redit the data and again rest validation and send to the server

— Button type"submit" is not used here

— Call e.preventDefault() only if the form is invalid

— Wut

— Why not?

— Because I don't know how to use submit actually

— So I just use button

— <input type="submit" value="Button text" />

— Onckick method