前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >专栏 >jquery 基础

jquery 基础

作者头像
用户5760343
发布2019-08-26 18:09:22
发布2019-08-26 18:09:22
4880
举报
文章被收录于专栏:sktjsktj

1 hide 按钮隐藏

id

. class p.class p#xxx

("[href$='.jpg']") 选取所有 href 值以 ".jpg" 结尾的元素。

2 css $("p").css("background-color","red");

hide("slow")

show

("p").toggle();

(selector).fadeOut(speed,callback);

(selector).fadeTo(speed,opacity,callback);

3\

(selector).slideUp(speed,callback); $(selector).slideToggle(speed,callback);

4 animate

("button").click(function(){

("button").click(function(){

("button").click(function(){ $("div").animate({ left:'250px', height:'+=150px', width:'+=150px' }); });

callback $("p").hide(1000,function(){ alert("The paragraph is now hidden"); });

链式写法 $("#p1").css("color","red").slideUp(2000).slideDown(2000);

text() html() val() attr("href")

更改属性:

("#w3s").attr({ "href" : "http://www.w3school.com.cn/jquery", "title" : "W3School jQuery Tutorial" }); });

("p").prepend("Some prepended text.");

("img").before("Some text before");

("#div1").empty(); $("p").remove(".italic");

("h1,h2,p").removeClass("blue"); });

("h1,h2,p").toggleClass("blue"); });

("h1,h2,p").addClass("blue"); $("div").addClass("important"); });

("p").css("background-color","yellow");

("button").click(function(){ var txt=""; txt+="Width: " +

("#div1").height(); $("#div1").html(txt); });

("#div1").innerWidth() + "</br>"; txt+="Inner height: " +

("#div1").html(txt); });

("#div1").outerWidth() + "</br>"; txt+="Outer height: " +

("#div1").html(txt); });

$("span").parent();

("span").parents("ul"); $("span").parentsUntil("div");

$("div").children();

("div").find("span"); $("div").find("*");

("h2").next();

("h2").nextUntil("h6"); jQuery prev(), prevAll() & prevUntil() 方法

("div p").last();

("p").not(".intro");

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019.08.25 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • id
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档