【问题标题】:how to add value to textarea [duplicate]如何为textarea添加价值[重复]
【发布时间】:2012-12-04 07:59:23
【问题描述】:

可能重复:
How to add default value for html <textarea>?

我正在使用 ajax 将数据从表单发送到数据库,并且我有探针:

<input class="input" type="text" name="do_kogo" id="odbiorca" size="25" value="<?php print $odbiorca; ?>" />
<input class="input" id="temat" type="text" name="temat" size="25" value="<?php print $temat; ?>"/>
<textarea id="tresc_area" name="tresc" cols="45" rows="10" ></textarea>

如您所见,我将值更改为 php 等效值,但我不知道如何更改 textarea 的值以放在那里&lt;?php print $tresc; ?&gt;如果有人知道如何执行此操作,请帮助我。我将不胜感激。

【问题讨论】:

    标签: php ajax


    【解决方案1】:

    您可以在&lt;textarea&gt; 开始和结束标记之间添加值。

    <textarea id="tresc_area" name="tresc" cols="45" rows="10" ><?php print $tresc; ?></textarea>
    

    【讨论】:

    • 啊,我想了想并尝试了。我意识到我的问题不在这里。感谢@Dr 的回答。丹
    猜你喜欢
    • 2013-05-16
    • 1970-01-01
    • 2019-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-11
    相关资源
    最近更新 更多