Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is "name" attribute mandatory in <input>, <textarea> and <button> elements?

Is "name" attribute mandatory in <input>, <textarea> and <button> elements? Or maybe we can use id or class instead?


1 Answers

  • If these tags are inside a form tag and you are subbmitting that form to a server, then name is required,
  • If you are just using them for client-side purposes and don't want to send them to server, then it is optional.
like image 81
Vlas Bashynskyi Avatar answered Oct 23 '25 21:10

Vlas Bashynskyi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!