[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 585
  • Last Modified:

Get rid off textarea leading spaces

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
gbzhhu
Asked:
gbzhhu
  • 7
  • 7
1 Solution
 
rucky544Commented:
textarea shouldn't have a value property, can't see anything else wrong with it though!?!
0
 
gbzhhuAuthor Commented:
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
 
BadotzCommented:
>> problem but got fixed when I took indentation off the code

Could you clarify, please?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
rucky544Commented:
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
 
gbzhhuAuthor Commented:
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
 
gbzhhuAuthor Commented:
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
 
rucky544Commented:
there is no reason why that alone would work?
0
 
rucky544Commented:
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
 
gbzhhuAuthor Commented:
>>there is no reason why that alone would work?
which one?
0
 
rucky544Commented:
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
 
gbzhhuAuthor Commented:
rucky544:

I can't remember whether the ckosing textarea tag was on the same line or not
0
 
rucky544Commented:
try turning JS off in your browser and then test the page.
0
 
gbzhhuAuthor Commented:
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
 
gbzhhuAuthor Commented:
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
 
rucky544Commented:
glad you got it sorted in the end....
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 7
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now