How to remove <p> and <br> tags appearing in textarea

Hello,

I’m using a WP template for my website. I’m having trouble adding spaces within the content in my textarea. Every-time I add an enter a <p> or <br /> tag appears in the visual editing.

If I remove them within the visual editor they just automatically appear again.

I can’t find anything from searching Google on how I can fix this. Does anyone know how I can get them not to appear?

Thanks in advance.

Website for reference: http://fightgymdirectory.com.au/gymlistform

Well, this isn’t an HTML issue per se… it sounds more like the editor you are using. Does WP come with an editor like Drupal etc does? Some kind of wysiwyg-type editor?

If so, usually there’s a place where that can be configured.

Typing a space, return, etc in a regular HTML editor adds nothing but the space or newline you typed.

If you’re typing into this textarea as if you were browsing the site, then I wonder if it’s a plugin that is automatically adding these tags. That also seems pretty likely. Maybe someone here with WP experience happens to know which widgets/plugins do this, but if you already knew you could disable it. There are plugins to make proper HTML around things like comments for blogs. You should be able to turn it off, or state which tags are allowed, or something like that.

Thanks for the reply. I’m not exactly sure what you mean. The visual editor doesn’t have any code related things for a textarea, it has <code> but that doesn’t really do anything.

I have added spaces and new lined in the regular HTML and also visual and still the end result is <p> and <br /> tags.

I don’t think any of the plugins I have activated would be causing this issue. Is the plugin you referenced something attached to the visual editor to create a text area, or for blog comments only?

Any further help is appreciated.

As I don’t use WordPress I can’t tell you if it’s a widget. However I do know this isn’t any default behaviour of HTML.

Ah, did you mean the read-only textarea with the terms and conditions?
If it’s that, then you are filing it in with an editor you use to edit HTML and not typing via the browser (what I thought you meant at first, like if I were to fill that form out).

So then the problem is certainly the text editor you are using to write HTML. With an ordinary text editor such as Notepad++ or vi you would not get any automatic HTML tag insertion. Stuff listed inside a textarea is usually treated as literal except it also wraps.

Try opening that particular page in Notepad++ or whatever default plain text editor you have installed on your computer (not Word or any word processing program). Just about every computer comes with a text editor by default.

You should be able to open the HTML file, type your text in, and save the file. So long as it’s saved with the same charset your regular editor is saving it as, it should work and no extra tags. BTW you may also want that textarea to be readonly. <textarea cols=“70” rows=“4” readonly=“readonly”> which is what I do with terms&conditions in a textarea.

Some WYSIWYG editors automatically insert code because it’s supposed to be “helpful”. Why I don’t use those : )

Hi,

I found its answer in one of the forum.You need a scripting to replace <p> with carriage return chr(13).

Chk out this link:

http://www.webmasterworld.com/new_web_development/3027687.htm

I must have completely misunderstood you. I thought you wanted to remove HTML tags from the textarea.

I don’t use any scripting and do not have any HTML showing up in my textareas.

*edit duh, two different people. Lawlz.

Thanks bluebelt91, as I am using wordpress I’m not sure how I can implement the aspx code as referenced on the forum you linked too. Is this is the only way to fix this? Is it possible to place code around the <textarea> instead of above the head tags etc which are a bit confusing for me when on a WP platform.

Thanks for any follow up help.

First, wp uses PHP, so if you were going to use a script, it would be PHP (and likely there is a pre-written php script, specifically for WordPress even, that does this (adds tags to textareas) prolly using PHP’s htmlentities()

But second, I think you already have a script in your whole wordpress setup that’s adding tags, and that maybe you could ask on a wordpress forum where to go to disable it, because as I said, this adding of tags is NOT anything regular HTML does. It must be something (a script) in wordpress doing this.