html swallows tag This is a very strange problem that I struggled with for several days. At first I thought it was connected with so...">

<textarea / "> html swallows tag

This is a very strange problem that I struggled with for several days. At first I thought it was connected with something in our application, but I split it into the simplest html page, and this is still happening. Basically, at any time I add a tag to the html page after it is displayed as a value. <textarea></textarea> fixes the problem, but I don’t understand why. I'm at a loss here, it must be something really simple that I just don’t know.

In the following example, paragraph tags are displayed as the value of the text area.

I am using IE8.

 <html> <head> <title>About</title> </head> <body> <textarea/> <p align="center"> test </p> <p align="left"> test </p> </body> 

+6
source share
4 answers

<textarea> not a self-closing tag. It should be rewritten as <textarea></textarea>

+28
source

I assume that you are trying to make paragraphs appear after the text area. Try not to use the textarea tag as an empty tag.

 <textarea></textarea> <p align="center"> test </p> <p align="left"> test </p> 
+4
source

I believe that Textarea requires an opening and closing tag - at least the way it is presented here: textarea in w3schools

+3
source

I also had this problem. I realized that I forgot to give the name attribute to my textarea , like all my other inputs, so that the PHP script could collect everything and send it to the SQL table.

As soon as I gave him a name, he magically stopped interrupting the closing tag and made it a closing tag, which was ignored by the browser until he ran into the closing textarea tag with the name attribute, swallowing everything in between. Hopefully this also sheds more light on this issue, as the text between the closing tags was not ideal for me.

-1
source

Source: https://habr.com/ru/post/885917/


All Articles