Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get rid off textarea leading spaces

Posted on 2007-03-23
15
Medium Priority
?
583 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

636 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