我有某些将<div>
内容复制到<textarea>
的代码,但它不会复制<div>
. 它以普通字体粘贴。我该如何解决这个问题?
HTML
<input type="text" id="styledText" placeholder="Place your Name..." size="50" name="styledText" class="changeMe">
<div id="fontselect" class="changeMe" onClick="copyText()" style="font-family: Times New Roman;font-size: 22px; font-weight: bold; cursor:pointer;">Place your Name...</div>
Javascript
function copyText() {
var output = document.getElementById("fontselect").innerHTML;
document.getElementById("styledText").value = output;
}
提前致谢 :)