Why don't the HTML <input>
tags get a closing tag like other HTML tags and what would go wrong if we do close the input tag?
I tried to Google and I found the standard to write a input tag like this <input type="text" name="name">
not closing it with a </input>
.
I personally felt the problem when I created an input tag for Radio
buttons using
var DOM_tag = document.createElement("input");
This though created a radio button, but the TextNode
I appended to the radio button with
document.createTextNode("Radio Label");
does not work. It simply shows the radio button with no Radio Label
as in this case.
Though I can see the complete code:
<input id="my_id" type="radio" name="radio_name">Radio Label</input>
What is explanation?
P.S.
The main problem that occurred to me is the automatically closing of input tag as I mentioned in the question as I am using var DOM_tag = document.createElement("input");
which automatically creates a closing tag. What should I do about that?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…