+ 1

Difference between id and name attributes of input

<input id="searchitem" name="search" type="search" /> what is use of id and name here and what is difference between them??

21st Jun 2018, 7:13 AM
Ashutosh Tripathi
Ashutosh Tripathi - avatar
3 odpowiedzi
0
id and name are identifiers to access these objects in dom with javascript or some other language. ideally every element should have id, but angular enforce to have unique name available.
21st Jun 2018, 12:33 PM
Sumesh
+ 1
The value of input is saved in id or name?
21st Jun 2018, 12:35 PM
Ashutosh Tripathi
Ashutosh Tripathi - avatar
0
none. value is saved in value attribute. id is used to access control.
21st Jun 2018, 12:48 PM
Sumesh