| Author |
empty tags
|
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
I've just figured out that empty tags are not working when playing with DOM. For example : <div .... /> <input...> With the DOM inspector, I've realized that input was inside div !! Instead, I had to write : <div .... ></div> <input...> Why is this so ? Do I have to set something to be able to use empty tags ?
|
[My Blog]
All roads lead to JavaRanch
|
 |
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
|
posted

0
|
Did you put a space before the slash? It is required in some browsers ie <do this /> <not this/>
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
No I did not put any space.
|
 |
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
|
posted

0
|
|
have you tried it with a space?
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
because a div is not supposed to be an empty tag. Eric
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
validate the code on the w3 validator. Eric
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
According to a strict XML interpretation, <div/> should mean the same thing as <div></div>. But the browsers are notorious for following their own rules. Bottom line, use <div></div>. P.S. Don't try that with the script tag either. [ September 01, 2006: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Thank you all. From now on, I'll avoid using empty tags.
P.S. Don't try that with the script tag either.
Actually, that's also why I asked I've wasted half an hour trying to figure out why my script was not being called
|
 |
 |
|
|
subject: empty tags
|
|
|