<div id="div1" class='A B C D'></div>
将div1里面class全部修改成E F G H
$('#div1').attr('class','E F G H'); //二者是一样的 $('#div1').attr('className','E F G H');
但是
document.getElementById('div1').className='E F G H' //正常 document.getElementById('div1').class='E F G H' //失败
jQuery里面
jQuery.props = { "for": "htmlFor", "class": "className", readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", colspan: "colSpan", tabindex: "tabIndex", usemap: "useMap", frameborder: "frameBorder" };
name = notxml && jQuery.props[ name ] || name;