I have a <div>
displaying the result fetched from backend. This <div>
contains a bunch of children <span>
s, with each corresponding to a named value from the backend returned result. Like this:
<div id="result-display">
<span name="name-one"></span>
<span name="name-two"></span>
</div>
For each updating cycle, the script just looping through all the <span>
s with an attribute of name
, and fill the value into it.
In testing, it works. But I've found out that using name
attribute for elements other than input
is considered bad practice. Why?