textarea can't have a default value [duplicate]

不想你离开。 提交于 2019-12-31 03:23:23

问题


check these lines please

<textarea class="wideInput" cols="30" rows="10" value="<?php echo $row['foodDescription']; ?>" ></textarea>
            <input value="<?php echo $row['foodDescription']; ?>" />

the input type has the default value, but the textarea doesn't , why please , what is the solution?


回答1:


There is no value attribute

<textarea class="wideInput" cols="30" rows="10" ><?php echo $row['foodDescription']; ?></textarea>



回答2:


You can add value in between <textarea> starting and ending tag.

<textarea class="wideInput" cols="30" rows="10"><?php echo $row['foodDescription']; ?></textarea>



回答3:


<textarea class="wideInput" cols="30" rows="10" value="<?php echo $row['foodDescription']; ?>" ></textarea>

should be changed to:

<textarea class="wideInput" cols="30" rows="10"><?php echo $row['foodDescription']; ?></textarea>

because textarea doesn't have value attribute




回答4:


Simply put the value in between the textarea tags:

<textarea class="wideInput" cols="30" rows="10">
    <?php echo $row['foodDescription']; ?>
</textarea>



回答5:


A textarea isn't like an input, it can't be self-closed (<textarea/>), it is self closing tags that can have a value to default display. Just change your code to echo the foodDescription inside the <textarea></textarea> tags




回答6:


You have to put the default value between the tags so:

<textarea class="wideInput" cols="30" rows="10"><?php echo $row['foodDescription']; ?></textarea>



回答7:


It has to be in-between the tags.

<textarea class="wideInput" cols="30" rows="10"><?php echo $row['foodDescription']; ?></textarea>

Lol preaching to the choir



来源:https://stackoverflow.com/questions/15383397/textarea-cant-have-a-default-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!