【发布时间】:2015-02-26 12:20:37
【问题描述】:
我正在尝试构建一个文本编辑器,为此我正在使用文本区域来填写我的文本
我的问题是当我点击一个按钮时,文本区域的选择消失了。
这里有一些代码来说明问题:
<!DOCTYPE html>
<html>
<body>
Address:<br>
<textarea id="myTextarea">
California Road
</textarea>
<p>Click the button to select the contents of the text area.</p>
<button type="button">Try it</button>
</body>
</html>
【问题讨论】:
-
@mplungjan — 它会带来什么好处?
-
因为是表格,不能为空
-
当我知道所选文本时,我可以添加一些标签@Quentin
-
我也试过 input type = button @mplungjan
标签: javascript onclick textarea selection