Reputation: 51
I need to just clone a element's value to an another element
<a id="button" href="">Google</a>
I want print value on div
<div id="destination">Google</div>
jQuery : With this, all a
tag have been cloned ! I want just clone the value of element !
$("#button").clone().appendTo('#destination');
Thanks for your help
Upvotes: 0
Views: 20
Reputation: 16855
However there are several ways you can achieve this
$('#destination').html($('#button').html());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a id="button" href="">Google</a>
<div id="destination"></div>
$('#destination').text($('#button').text());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a id="button" href="">Google</a>
<div id="destination"></div>
Upvotes: 2