Textarea为文本开头添加空间? [英] Textarea Adding Space To Beginning of Text?

查看:92
本文介绍了Textarea为文本开头添加空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个奇怪的问题,那就是我的php插入文本到< textarea> < textarea> 在我的文本的顶部添加一个空白区域。



我创建了一个示例页面来显示问题...在这里,代码背后的代码

 < textarea style =width:600px; height:100px;><?php get_film_info('主要描述'); ?>< / textarea的> 
< br>
< textarea id =mainDescription style =width:600px; height:100px;>仅在< / textarea>中输入文字
< br>
<?php get_film_info ('main description');?>

你可以看到没有< textarea> 标记,文本不包含缩进。我的数据库也反映没有缩进,以及< textarea> ...



任何线索可能会发生什么? http://clients.contradictiondevelopment.com/7thart.com/test.php?filmIndex=17 =nofollow noreferrer>示例页面



<当你添加数据时(通过ajax),我发送了我的数据,例如:。 var data ='& main_description ='+ mainDescription 。注意=和+之间的空格。 b

谢谢大家你的输入,只需要给列表顶部的那个人一个勾号。

解决方案

正如在页面源中可以看到的那样。也许 get_film_info()会无意中注入它们。


I'm having a strange problem in that I have php inserting text into a <textarea> and the <textarea> is adding one white space to the top of my text.

I created an example page to display the problem... here it the code behind the page.

<textarea style="width:600px;height:100px;"><?php get_film_info('main description'); ?></textarea>
<br>
<textarea id="mainDescription style="width:600px;height:100px;">Text just typed in</textarea>
<br>
<?php get_film_info('main description'); ?>

You can see that without the <textarea> tag, the text does not include the indent. My database also reflects no indent, as well as the php output outside of the <textarea>...

Any clue what could be going on?

the sample page

Edit: You were all right, of course I didn't bother checking the source code of the output file. Turns out when I was adding the data (via ajax) I was sending my data like var data = '&main_description= ' + mainDescription. Notice the space between the "=" and the "+".

Thank you all for your input, gotta just give the check mark to the guy on the top of the list.

解决方案

There's definitely a space in the beginning and one at the end, as can be seen in the page source. Perhaps get_film_info() is inadvertently injecting them.

这篇关于Textarea为文本开头添加空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆