1. 一般写法
$(".ul-box").on("click",".ul-list li a",function(){
$(this).css("color","red");
});
2. 两个事件的写法
$(".ul-box").on("mouseover mouseout",".ul-list li a",function(event){
if(event.type == "mouseover"){
$(this).css("color","red");
} else if(event.type == "mouseout"){
$(this).css("color","#333");
}
});
3. 委托 delegate, 注意:参数与一般写法刚好反过来了
$(".ul-box").delegate(".ul-list li a","click",function(){
$(this).css("color","red");
});