`

jquery demo

阅读更多
1.当把鼠标放在li对象上面和移开时进行样式切换,但只在list的最后一个element上生效
htm:
<div id="orderedlist">
<li>11111</li>
<li>22222</li><li>33333</li>
</div>

js:
$(document).ready(function() {
$("#orderedlist li:last").hover(function() {
$(this).addClass("green");
}, function() {
$(this).removeClass("green");
});
});
--------------------------------------------------------
$(document).ready(function() {
$("#orderedlist").find("li").each(function(i) {
$(this).html( $(this).html() + " BAM! " + i );
});
});
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics