Why is textarea filled with mysterious white spaces?
Look closely at your code. In it, there are already three line breaks, and a ton of white space before </textarea>
. Remove those first so that there are no line breaks in between the tags any more. It might already do the trick.
Why is textarea filled with mysterious white spaces?
Look closely at your code. In it, there are already three line breaks, and a ton of white space before </textarea>
. Remove those first so that there are no line breaks in between the tags any more. It might already do the trick.
Default Value TextArea Mysterious Spaces
You have indentations in the html. ANYTHING that appears between the opening/closing <textarea>
tags becomes PART of the text area:
<div class="col-sm-12">
<textarea name="description" class="form-control" rows="5" placeholder="Desciption">
^
{{$description}}
^^^^^^^^ ^
</textarea>
^^^^
</div>
The ^
mark the spaces you're getting. If you don't want those spaces, then don't have them:
<textarea>foo</textarea>
v.s.
<textarea>
^--line break at start of textarea content
foo
^^^^----spaces
^--another line break
</textarea>
Textarea has mysterious whitespace
Content in #song-title
element must have new lines.
Given:
<div id="song-title">
Pieces - Red
</div>
$("#song-title").text();
would return:
"
Pieces - Red
"
Textarea with white space detect
HTML itself does not provide a "preview" for textareas. However, if you submit it to a PHP script you can use nl2br()
to convert linebreaks into html linebreaks.
Before doing so you need to use htmlspecialchars()
to escape HTML tags unless everyone using that form is trusted enough to enter arbitrary html.
Related Topics
How to Use PHP to Dynamically Publish an Ical File to Be Read by Google Calendar
Regular Expression to Check If the String Has Chinese Chars
Php: How to Resolve a Relative Url
Create a Zip File and Download It
Escape String to Use in Mail()
Ajax Call with Contenttype: 'Application/JSON' Not Working
How to Convert PHP Date Formats to Gmt and Vice Versa
Get Size of Post-Request in PHP
Programmatically Access Currency Exchange Rates
How to Export a SQL Table Without Access to the Server or PHPmyadmin
Which Is Faster and Better, Switch Case or If Else If
How to Detect Country/Location of Visitor
Many Hash Iterations: Append Salt Every Time
Why Is Crontab Not Executing My PHP Script