loading...

Posts Tagged ‘常用方法

jQuery 常用方法一览

by: ponytail @ 14 五 , 2010 in: ┨Stuuuuuuuudy    

关于1.4的新特性,可以参看 帕兰映像 – jQuery 1.4官方文档中文版

Attribute:

$(”p”).addClass(css中定义的样式类型); 给某个元素添加样式
$(”img”).attr({src:”test.jpg”,alt:”test Image”}); 给某个元素添加属性/值,参数是map
$(”img”).attr(”src”,”test.jpg”); 给某个元素添加属性/值
$(”img”).attr(”title”, function() { return this.src }); 给某个元素添加属性/值
$(”元素名称”).html(); 获得该元素内的内容(元素,文本等)
$(”元素名称”).html(”new stuff”); 给某元素设置内容
$(”元素名称”).removeAttr(”属性名称”) 给某元素删除指定的属性以及该属性的值
$(”元素名称”).removeClass(”class”) 给某元素删除指定的样式
$(”元素名称”).text(); 获得该元素的文本
$(”元素名称”).text(value); 设置该元素的文本值为value
$(”元素名称”).toggleClass(class) 当元素存在参数中的样式的时候取消,如果不存在就设置此样式
$(”input元素名称”).val(); 获取input元素的值
$(”input元素名称”).val(value); 设置input元素的值为value

Read the rest of this entry »

1 Comment 1,479 views



Web Share

About Me

    Enjoy Work!&& Enjoy Life!

  • 年过半百的一半却只能通过绑定来实现社会化的不想宅却没有办法的挺宅的向往B型却只是O型的不会游泳所以只能沉沦腐海的爱K歌但还不到麦霸程度的现在貌似挺稀有的白羊挨踢代码女
  • 硬盘控、下载强迫症、HTC大脸人、伪谷粉
  • Money是好物!Wordpress是好物!Jquery是好物!

Latest Comments

  • 前端开发: 我看了下原文,horizontally 是水平的意思,希望博主尽早发现并修改
  • 前端开发: 第30条跟《高性能网站进阶指南》有冲突,书上是说css精灵要排成横的,而
  • amazon is my niche Keyword.: ... [Trackback]... [...] Read More: iros.me/2009-css-naked-day-jin-tian-shi-css-lu
  • My Homepage: ... [Trackback]... [...] Find More Informations here: iros.me/2009-css-naked-day-j
  • 在线k歌: 有意思 。。
  • liugod: 很好,作为参考
  • Modern Warfare 3: Modern Warfare 3... I saw this really good post today so I had to repost..........
  • En Vivo: Twitter Instantly connect to what's most important to you. Follow your friends, experts, favorite
  • 洋洋: 这个码字得多累啊。。
  • Chong.Freeman: 第一次见这么详细的关于 query_posts 函数的讲解。 学习了! 有这函数,做

疼讯微博口水地

My Place

    Posts 98  Comments 186  
    Blog stared at 2008.10.21
    Blog open at 2008.11.21   Free Traffic Counter
ponytail1985@hotmail.com 358589691 ponie325@gmail.com Ajax CommentLuv Enabled 275ca7ef21959162b094a66262fa328f