jQuery 知识点积累

1.判断checkbox是否选中
   $("#aa").prop("checked")==true
2.给属性赋值
   $("#aa").prop("checked",true) $("#aa").prop("readonly",true) $("#aa").prop("disabled",true)
prop()只能返回true和false,对于一般bool类型使用prop,否则使用attr
$("#aa").removeProp("dd")删除自定义的属性,不要删除原生态的属性

3.全局设置ajax
$.ajaxSetup({  cache: true, async = false });

4.var p = $("p").detach();删除之后保存被删除的元素数据

5. $("#Span1").replaceWith("<span title='replaceWith'>Rainier</span>");
             $("<span title='replaceAll'>han163@163.com</span>").replaceAll("#Span2");
将<span id="Span1"></span>替换为<span title='replaceWith'>Rainier</span>
("#Span2")替换为<span title='replaceAll'>han163@163.com</span>

posted @ 2013-06-30 17:15  学亮  阅读(188)  评论(0编辑  收藏  举报