JQuery Basic Features Quick Walkthrough
1. Basic Selectors
$('p')—Accesses all the paragraph elements in the HTML file
$('div')—Accesses all the div elements in the HTML file
$('#A')—Accesses all the HTML elements with id=A
$('.b')—Accesses all the HTML elements with class=b
2. Applying CSS to Elements
$('div').addClass('highlight');
3. Some basic selection APIs
// select all the elements that contain the text Life
$('span:contains(Life)').addClass('highlight'); $('div:odd').addClass('highlight');
$('div:even').addClass('boundary');
$('p:eq(1)').addClass('linkstyle');
4. Obtaining the HTML of an Element
alert($('p').html());
5. Changing the Content of a DOM Node
$('#textId').text('some text content'); $('p').html('<b>We can create Rich Internet Applications </b><br/>by making AJAX requests');
6. Creating a DOM Node on the Fly
1) Inserts the specified content at the beginning of the selected element and returns a jQuery object
$('p').prepend('<h2> Power of selectors </h2>');
JQuery Basic Features Quick Walkthrough的更多相关文章
- How to Create a Basic Plugin 如何写一个基础的jQuery插件
How to Create a Basic Plugin Sometimes you want to make a piece of functionality available throughou ...
- [Windows Azure] Walkthrough to Configure System Center Management Pack for Windows Azure Fabric Preview for SCOM 2012 SP1 (with a MetricsHub Bonus)
The wait is finally over. This is a huge update to the Azure Management Pack over the one that was r ...
- How to Create a Basic Plugin
Sometimes you want to make a piece of functionality available throughout your code. For example, per ...
- jQuery入门[1]-构造函数【转载】
最近看了一些jquery的进阶教程,感觉很不错,与大家分享下! jQuery——构造函数 ◦体积小(v1.2.3 15kb)◦丰富的DOM选择器(CSS1-3 + XPath) ◦跨浏览器(IE6,F ...
- 21个很棒的jQuery分页插件下载
分页是指将一个大内容划分为各种不同的页面,因此网站的分页是一个很重要的部分,必须让内容有组织性和易于访问.分页有各两种不同的方式,手动跟自动.最受欢迎简单和广泛的方法是jQuery插件.下面我们收集了 ...
- JavaScript大杂烩15 - 使用JQuery(下)
前面我们总结了使用各种selector拿到了jQuery对象了,下面就是对这个对象执行指定的行为了. 2. 操作对象 - 行为函数action 执行jQuery内置的行为函数的时候,JQuery自动遍 ...
- JavaScript大杂烩14 - 使用JQuery(上)
JQuery意义 - Why? 为什么要使用JQuery,从我个人来说,就是这么几点:简化代码 + 统一行为 + 功能强大 + 搭配方便. 简化代码是从写代码的角度来说的,实现同样的功能,如果用Jav ...
- 一些必看的jQuery导航插件和教程
导航是一个网站最重要的元素之一,您必须遵循统一的风格来设计您的网站,特别是导航的风格,让用户可以轻松地找到他们想要的内容.这里最大的部分是开发一个菜单,即要直观易用,又要符合你网站的设计风格.本文列举 ...
- JQuery系列(2) - 事件处理
JQuery事件绑定 (1)on方法 on方法是jQuery事件绑定的统一接口.后面介绍的事件绑定的那些简便方法,其实都是on方法的简写形式. $('li').on('click', function ...
随机推荐
- <六>面向对象分析之UML核心元素之业务实体
一:基本概念
- 【转】Android fill_parent和wrap_content分析
fill_parent设置一个顶部布局或控件强制性让它布满整个屏幕. wrap_content布局指根据视图内部内容自动扩展以适应其大小. 1. wrap_content <?xml versi ...
- 最好用的汉字转拼音代码PinYin4Objc(PinYin4J的objc版本)
转:https://github.com/kimziv/PinYin4Objc 最好用的汉字转拼音代码PinYin4Objc(PinYin4J的objc版本)(更新到v1.1.1,增加block异步处 ...
- Using Open Source Static Libraries in Xcode 4
Using Open Source Static Libraries in Xcode 4 Xcode 4.0.1 allows us to more easily create and use th ...
- 多线程监控文件夹,FlieSystemWatcher,并使用共享函数
发表于: 2011-01-06 09:55:47 C# code ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 ...
- Java中实现复制文件或文件夹
拷贝一个文件的算法比较简单,当然,可以对它进行优化,比如使用缓冲流,提高读写数据的效率等.但是在复制文件夹时,则需要利用Flie类在目标文件夹中创建相应的目录,并且使用递归方法. [java] vi ...
- Devexpress DateEdit选年月 z
Mask与Display只显示年月2012-02这种格式,但用户选择起来还是不爽,体验太差. 效果如下: 代码: using Microsoft.VisualBasic; using System; ...
- UVA 12532-Interval Product(BIT)
题意: 给n个数字的序列,C v p 把v位上的数字置成p , S l r代表求区间[l,r]各数字相乘得数的符号,对于每个S输出所得符号(’+‘,’-‘,’0‘) 分析: 开两个数组表示区间负数的个 ...
- IOS Swizzle(hook)
/////////////////////////////////////////////////////////////////////////////////////////////////// ...
- Text Kit进阶
在上一篇文章Text Kit入门中我们主要了解了什么是Text Kit及它的一些架构和基本特性,这篇文章中会涉及关于Text Kit的更多具体应用. Text Kit是建立在Core Text框架上的 ...