Solved

Get rid off textarea leading spaces

Posted on 2007-03-23
15
577 Views
Last Modified: 2008-01-09
I am having a nightmare with HTML textarea tag.  No matter what i do it will put spaces before the cursor.  so when i tab to an empty textarea the cursor will go a few spaces to the right.  I have seen many solutions here at EE I tried those applicable (take all spaces off, unindent everything)  I ended up with this --- everything in one line -- yet the problem is still there.

<tr><td >&#160;</td><td valign="top"><font style="FONT-SIZE: 9pt; COLOR: 417D41;  FONT-FAMILY: Arial">Comments:</font></td><td><textarea name="comments" rows="3" cols="5" value="" ID="Text142" style="width: 400px; border: 1 solid #8CC38C; color:4C854C;"></textarea></td><td >&#160;</td></tr>

Where the clever clogs?  help please
0
Comment
Question by:gbzhhu
  • 7
  • 7
15 Comments
 
LVL 5

Expert Comment

by:rucky544
ID: 18781183
textarea shouldn't have a value property, can't see anything else wrong with it though!?!
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 18781236
Removed the value property but no luck :-(  still the same.  Strange enough I have another page that had the same problem but got fixed when I took indentation off the code.  This is IE but I just tried FireFox.  The same result!!
0
 
LVL 29

Expert Comment

by:Badotz
ID: 18781323
>> problem but got fixed when I took indentation off the code

Could you clarify, please?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 5

Expert Comment

by:rucky544
ID: 18781351
can you delete the space that it puts in at the start?

have you got any javascript or CSS that is working on id="Text142" or textarea?

The actual textarea code is fine... it must be something else effecting it!
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 18781396
Badotz:

In another page, I had another textarea tag.  Initially it was behaving the same as the one I posted the question for.  That is when I tab to the empty textarea, the cursor was  going a few spaces to the right (not at the beginning) this causing leading spaces.  My code was indented example below
<tr>
   <td>
          <textarea name="BBB" etc></textarea>
   </td>
</tr>

I remove the indentation

<tr>
<td>
<textarea name="BBB" etc></textarea>
</td>
</tr>

and it worked

BUT it doesn't work for this particular textarea.  Weird!!
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 18781438
rucky544:

Yes, I can delete the spaces

I have a javascript that puts a particular (named) textarea some values.  I renamed my textarea to commentsxx and the ID to id="Text142XX".  It made no difference.

The following javascript removes the spaces but it is only a workaround.  I wanted to find the reason and fix it.

I must reboot my PC!!  Fixes most problems!!!
 onFocus="javascript:while(''+this.value.charAt(0)==' ')this.value=this.value.substring(1,this.value.length);"
0
 
LVL 5

Expert Comment

by:rucky544
ID: 18781443
there is no reason why that alone would work?
0
 
LVL 5

Expert Comment

by:rucky544
ID: 18781475
can you put the page up for us to see? It sounds like JS is adding in some spaces for some reason. Because it isn't the HTML and can't be CSS if it is putting actual spaces in there.
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 18781483
>>there is no reason why that alone would work?
which one?
0
 
LVL 5

Expert Comment

by:rucky544
ID: 18781501
sorry i meant the indentation. takeing indentation out of the code wouldn't make any difference unless maybe it was like

<tr>
   <td>
          <textarea name="BBB" etc>
          </textarea>
   </td>
</tr>

Then it might have put extra spaces in at the beginning of the textarea.
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 18781573
rucky544:

I can't remember whether the ckosing textarea tag was on the same line or not
0
 
LVL 5

Accepted Solution

by:
rucky544 earned 500 total points
ID: 18781584
try turning JS off in your browser and then test the page.
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 18781587
The site is commercial and will need logging in therefore I cannot put the page up but I can post the output here if it helps.

Also I am not using CSS.
0
 
LVL 12

Author Comment

by:gbzhhu
ID: 18781654
ARRRGHHHH!!!

Ok, calm down.  On trying to do what rucky544:said (turn of JS) I opened a new browser screen, relogged in to the site and run the page. NO PROBLEM!!!  Bloody browser must have been caching stuff.  Now I even refreshed the older browser screen and it works there too.  That is why i said I should restart PC which i didn't.

Thank you all so much.  Points go to rucky544:
0
 
LVL 5

Expert Comment

by:rucky544
ID: 18781668
glad you got it sorted in the end....
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question