【发布时间】:2014-01-24 11:26:35
【问题描述】:
对这个很困惑。构建了一个带有相应预览的简单输入表单(它本质上是创建一个调查),但由于某种原因,右侧的预览文本永远不会显示最后一个字符。查看截图:https://www.evernote.com/shard/s144/sh/f1c45522-6bcd-4241-aae8-70497c4bc757/3888c44d7c34481ce791974551fbcda0/res/832f002a-57ab-4d35-8233-455cd8a5d247/skitch.png)
这是输入的代码:
.control-group
%label.control-label for="product-name"
Product Name
%a#help-campaign-product.icon-question-sign title="The name of the product or service whose features you are trying to value. Your survey respondents will see this."
.controls
%input#product-name.input-xlarge.required type="text" name="product-name" placeholder="My Product" value="{% if campaign.product_name %}{{ campaign.product_name }}{% endif %}"
以及预览代码:
#campaign-title
.wrapper
%h4#campaign-product-name style="text-align:center; font-family: Helvetica Neue,Helvetica,Arial,sans-serif; font-weight:300; font-size:24px;"
My Product
#preview-product-description style="display:none;"
%h4#campaign-headline style="text-align:center; font-family: Helvetica Neue,Helvetica,Arial,sans-serif; font-weight:300; font-size:24px;"
我很困惑。 :(
【问题讨论】:
-
Evernote 显示错误消息“拒绝访问”并希望我登录。小心添加有问题的代码,也许添加jsfiddle.net?
-
如果没有看到
#campaign-title、.wrapper和h4的计算 CSS,很难说。看起来你有一个固定的宽度和溢出:隐藏。 -
您可能太早更新预览标题,例如onkeydown 还是 onkeypress?你应该使用 onkeyup。
-
@acoiro 就是这样。非常感谢您的建议。
标签: javascript html frontend dom-events haml