Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is using name attribute deprecated in HTML5?

Tags:

html

Should I use the name attribute only for form controls? Is it deprecated today in HTML5?

I noticed similar questions are outdated, so I'm a little confused.

like image 776
cookya Avatar asked Nov 22 '16 09:11

cookya


2 Answers

Should I use the name attribute only for form controls?

No. It is only on <a> elements that it is obsolete (and replaced with id on any element).

The attributes index in the HTML5 spec shows where it should still be used.

Some uses of it which were never standard should be replaced with class.

Is it deprecated today in HTML5?

HTML5 doesn't use the term "deprecated". It describes it as obsolete.

like image 112
Quentin Avatar answered Sep 22 '22 15:09

Quentin


It seems that using <a name=""> is depreciated - which means you shouldn't use it for your anchor tags.

On forms you should still use name="" to label your form controls - AngularJS requires you to use name="" if you ever want to use validation.

Some more information here and here.

like image 44
Tom Johnson Avatar answered Sep 20 '22 15:09

Tom Johnson