问问题
1217 次
3 回答
3
尝试:
$('#selections li').click(function() {
$('#id-of-your-textarea').append($(this).text() + '\n');
})
于 2013-05-10T03:27:14.130 回答
1
试试下面的方法,它会帮助你...
小提琴:http: //jsfiddle.net/RYh7U/155/
HTML:
<ul id="selections">
<li>Here is some text</li>
<li>Here is some more text</li>
<li>Here is even more text</li>
</ul>
<textarea id="txtData"></textarea>
查询:
$('#selections li').click(function(){
$('#txtData').val($('#txtData').val() + "\n" + $(this).text());
});
于 2013-05-10T03:34:40.237 回答
0
这样的事情应该这样做:
<script>
$(document).ready(function(){
$("#selections").children().each(function(){
$(this).click(function(){
$("#area").text($("#area").text() + $(this).html() + '\n');
});
});
});
</script>
<textarea id="area"></textarea>
<ul id="selections">
<li>Here is some text</li>
<li>Here is some more text</li>
<li>Here is even more text</li>
</ul>
于 2013-05-10T03:32:17.167 回答