jquery 使用技巧(持续更新中)

一、jquery 属性操作

1、增加和删除属性

      $("#id").attr("data-index",4),$("#id").removeAttr("data-index");自定义属性,建议使用attr

   $("#checkbox").prop("checked",false), $("#checkbox").removeProp("checked"),固有属性,建议使用prop

      

猜你喜欢

转载自www.cnblogs.com/cyfblogs/p/12909140.html