如何捕获“复制我”文本并将其附加到ID“#copy”中?
<span id="text">Copy me</span>
<span id="copy"></span>
答案 0 :(得分:0)
你可以用这个
$("#copy").append($("#text").text());
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span id="text">Copy me</span>
<span id="copy"></span>
&#13;
答案 1 :(得分:0)
$('#copy').html($('#text').text());
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<span id="text">Copy me</span>
<span id="copy"></span>
&#13;
答案 2 :(得分:0)
$('#copy').text($('#text').text());
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span id="text">Copy me</span>
<span id="copy"></span>
&#13;