zoukankan      html  css  js  c++  java
  • jquery中的文档操作之四

    removeAttr() 方法从被选元素中移除属性 $("p").removeAttr("style");

    removeClass() 方法从被选元素移除一个或多个类。如需移除若干类,请使用空格来分隔类名。$("p:first").removeClass("intro");

    感觉这个在使用是不会遵循 一定要把c使用currentClass

    $('ul li').removeClass(function(n, c) {
          return 'listitem_' + $(this).index();

    });

    replaceAll()与replaceWith()的差别

    replaceAll()    用匹配的元素替换所有匹配到的元素。$("<b>hello</b>").replaceAll("p");

    replaceWith()       用新内容替换匹配的元素。$("p").replaceWith("<b>Hello world!</b>");

    他们都可以自定义 使用新元素来替换元素 如 $("p").replaceWith(document.createElement("div"));

    除此之外replaceWith()还可以使用函数如下

     $("p").replaceWith(function(){
        return "<p>Hello World!</p>";
     });

  • 相关阅读:
    nginx配置文件详解
    centos 小知识
    nginx 常见问题
    centos7.5 安装nginx
    tomact 配置远程登录
    Centos7 离线安装 mariaDB
    Crontab详细用法-定时任务详解
    新项目push/pull到github
    GIT的基本操作
    hive的安装
  • 原文地址:https://www.cnblogs.com/luhangnote/p/2670461.html
Copyright © 2011-2022 走看看