我想知道有人可以帮忙解决这个问题。 我正在通过phonegap创建一个Java编译器应用程序,我有一个textarea,我只想在文本框中默认Java类名称(并且它不会消失)
所以我有如下
<div>
<label for="source">Source Code:</label>
<textarea cols="35" rows="10" name="source" id="source" value="class TryMe{"></textarea>
</div>
<div>
<label for="input">Input: <span class="description">(Data that will be given to the program on the stdin.)</span></label>
<textarea cols="35" rows="3" name="input" id="input"></textarea>
</div>
<div>
只是为了突出我的意思我已经添加了“value =”类TryMe {“只是让你知道我的意思。 最简单的做一个javascript函数。
答案 0 :(得分:0)
为html <textarea>
设置默认值就像这样
<textarea cols="35" rows="10" name="source" id="source"> VALUE HERE </textarea>
答案 1 :(得分:0)
Textareas没有值属性。您可以在元素
中简单地添加文本<textarea>class TryMe{</textarea>
您也可以使用占位符
<textarea placeholder="class TryMe{"></textarea>