<p>jQuery.attr ('class') 和 jQuery.attr ('className') 的区别</p><p><div id="div1" class='A B C D'></div></p><p>将div1里面class全部修改成E F G H</p><pre class="brush:js;toolbar:false">$('#div1').attr('class','EFGH');
//二者是一样的
$('#div1').attr('className','EFGH');</pre><p></p><p>但是</p><pre class="brush:js;toolbar:false">document.getElementById('div1').className='EFGH'//正常
document.getElementById('div1').class='EFGH'//失败
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;</pre>