?
Solved

whitespace in textarea

Posted on 2006-06-29
4
Medium Priority
?
885 Views
Last Modified: 2008-03-06
when I create a form it automatically inserts some whitespace, about 7 or 8 characters worth in the box,.

When I insert the $_POST data and trim it this solves the problem but how can I delete the space when the page is opened for the first time?


Ross
0
Comment
Question by:roscoeh23
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Eternal_Student earned 2000 total points
ID: 17008506
<form style="margin:0px; padding:0px;">

Different browsers will add different margin values if you dont declare them using css.
0
 

Expert Comment

by:CivilDisobedient
ID: 17008734
Either attach an event to the window.onload, or if you're not doing any other onload routines, put the following in your page:

<script type="text/javascript">
   document.getElementById('textAreaId').innerHTML = "";
</script>

<body>
   <textarea id="textAreaId"></textarea>
</body>

Alternatively, you could do this to *every* textarea onload with the following script substitution:

<script type="text/javascript">
   var elems = document.getElementsByTagName('textarea');
   for (var x=0, i=elems.length; x < i; x++) {
      elems[x].innerHTML = "";
   }
</script>
0
 

Expert Comment

by:CivilDisobedient
ID: 17008741
Forgot to wrap that function in the window onload handler:

<script type="text/javascript">
   window.onload = function() {

   ...code goes here...

   }
</script>
0
 
LVL 3

Expert Comment

by:zawedikian
ID: 17009099
hi
when u create ur form , check that all ur text ares are without spaces inside. If not, it wont be added when the page is opend
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month15 days, 1 hour left to enroll

839 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