Search code examples
htmlgedittextcolor

Why does '/>' cause a text-coloring error in an html doc in gedit?


$('#chatlog').append('<span class="'+colorCode+'">'+newMsg+'</span><br />');

See the /> at the end of the line? Those two characters turn greenish blue, and everything afterwards is just black-- it's like an error almost. No text coloring is present after that point in the document.

If I change it to <br / > (with a space between the / and the >) then it fixes the problem. But what's causing the problem in the first place?


Solution

  • I've never used Gedit, but older html specifications didn't allow for self-closing tags - you probably just need to tell it what flavor of html/xhtml/html5/whatever. A quick Google search says this is done by selecting the syntax highlighting language at the bottom right. :)