【发布时间】:2011-07-01 01:52:47
【问题描述】:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript">
function foo() {
$(this).parent('li').append('hello world');
}
</script>
<ul>
<li><img src="http://www.gravatar.com/avatar/a3981906ca415e0ec3e051076b71b0cd?s=32&d=identicon&r=PG" onClick="foo()" /></li>
<li><img src="http://www.gravatar.com/avatar/8ec1383b240b5ba15ffb9743fceb3c0e?s=32&d=identicon&r=PG" onClick="foo()" /></li>
</ul>
我正在尝试将字符串“hello world”附加到包含刚刚单击的图像的<li>。
【问题讨论】:
标签: javascript jquery click append