+ 2
Button "onlick" affecting "textarea" required?
https://sololearn.com/compiler-playground/W1Dt3ZOXoqDO/?ref=app That's my code. I was trying to apply '.checked' to checkbox input through button that is calling function in the script. So, when the button get clicked, the checkbox is marked. But, the 'textarea' tag also got affected and popping up "fill out...."
4 Answers
+ 4
Try adding the type="button" attribute to both of your top buttons. This behavior is happening for you because your buttons do not have a "type" specified and are inside a form. Because of this, they are being treated as submit buttons, which isn't what you're wanting here. When inside a <form> element, it's good practice to be clear what inputs/buttons are being used for. Happy coding!
0
if you are not actually doing any post request, you can omit the <form></form> tags.
0
Bob_Li no, i was just testing it just in case there is a situation where i want to build form like that later.
0
Daniel C yeah thanks. That really worked.