0
Good evening and sorry for the title little objective but it seemed difficult to holder this question but come on!
In an example element selector document.querySelector().anything
the attribute anything
is accepted normally? I can type anything in place, potato, lobster and will be accepted if I do document.querySelector("#anyID").batata = "doce".
works normally. It seems to me that the language automatically creates the potato index and assigns the string "sweet" to it... what is the use of this in terms of programming?
None. This will be ignored. O
JS
will only use the value if it is a valid attribute.– Valdeir Psr
I don’t understand what you mean, how is that valid? because this generated attribute "dynamically" appears to be valid kkk, and you can invoke it after that.
– Jefter Rocha
What do you mean
anything
?– Sam
anything, you can type any attribute for a selected element
– Jefter Rocha
@Jefterrocha as @Maíonferreira said, attribute and property are different. "Is the attribute Anything accepted normally?" no. The attribute will be ignored. It is different to inform
title
,style
etc that SANE valid attributes that will be embedded AS ATTRIBUTES in HTML. And this property will only be used, will only be useful if you create a specific code to use it, otherwise it will be ignored byJS
because (repeat) are a attribute valid.– Valdeir Psr