<div  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;

相关文章:

  • 2021-08-08
  • 2021-10-03
  • 2021-08-12
  • 2021-07-10
  • 2022-02-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
猜你喜欢
  • 2021-10-04
  • 2021-09-28
  • 2021-06-02
  • 2021-10-10
  • 2022-12-23
  • 2021-09-18
相关资源
相似解决方案