javascript - How to move content of div into another -
if have example divs class="text1", have a-tag class"text" on them.
<a class="text">clickhere1</a> <div class="text1" style="display: none"> <p>hey</p> <p>ho</p> </div> <a class="text">clickhere2</a> <div class="text1" style="display: none"> <p>hey</p> <p>ho</p> </div> <div id="content"> </div>
how can move content of class="text1" div id="content" when user clicks on a-tag directly on div wit class"text1". or better said when user clicks on a-tag content of next div class="text1" appended div id:content.
also im asking me how can insure in div id:content content of 1 div displayed!
thanks , hope understand me !
do want move, or copy?
to copy text:
$(".text").click(function() { $("#content").html($(this).next(".text1").html()); });
if want move text, use
$(".text").click(function() { $("#content").html($(this).next(".text1").html()); $(this).html(''); });
Comments
Post a Comment