我的html页面中有一个文本区域。它也有一个按钮。当我点击那个按钮时,我需要在文本区域复制一些文本。
这是正常工作的。
单击“复制”后,如果现在删除或编辑文本区域中的某些文本,如果再次单击“复制”,文本将不会被复制。
请帮帮忙。
下面是HTML代码。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<textarea cols="20" rows="20" name="mytext" id="mytext">Copy here .... </textarea>
<br>
<input type="button" value= "Copy" onclick="copy();"/>
<script>
function copy(){
$('#mytext').html( $('#mytext').html() + "some sample text message ");
}
</script>发布于 2013-08-02 12:04:08
使用瓦尔()而不是html()
function copy(){
$('#mytext').val( $('#mytext').val() + "some sample text message ");
}https://stackoverflow.com/questions/18016447
复制相似问题