【问题标题】:Textarea value="Value" not working onload, but will onblurTextarea value="Value" 在加载时不起作用,但会模糊
【发布时间】:2010-05-07 18:34:38
【问题描述】:

Here is my jsfiddle example,textarea onload没有显示value,但是会onblur,textarea不接受value属性吗?

【问题讨论】:

    标签: javascript html textarea


    【解决方案1】:

    Here is the solution :)

    因为您使用的是textarea,所以它的值位于其标签名称之间:

    <textarea class="jsf" name="msg" onblur="if(this.value=='') this.value='Write here!';" onfocus="if(this.value=='Write here!') this.value='';">Write here!</textarea>

    【讨论】:

    • 谢谢,但是如何将其添加到{textarea onblur="if(this.value=='') this.value='Skriv her';" onfocus="if(this.value=='Skriv her') this.value='';"}?在这个 smarty 系统中没有关闭标签的选项,我尝试使用{/textarea},但它破坏了它。
    • @Kyle Sevenoaks: 抱歉,我不知道 smarty,因为我还没用过 :(
    • 别担心,我会想办法的:) 感谢您为我指明正确的方向。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-29
    • 2011-12-06
    • 1970-01-01
    • 2021-12-12
    • 2013-06-20
    • 2019-06-24
    相关资源
    最近更新 更多