Query 允许链接(链式语法)。
2016-03-21 11:08
344 查看
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> </script> <script> function myFunction() { $("#h01").attr("style","color:red").html("Hello jQuery") } $(document).ready(myFunction); </script> </head> <body> <h1 id="h01"></h1> </body> </html>亲自试一试正如您在上面的例子中看到的,jQuery 允许链接(链式语法)。链接(Chaining)是一种在同一对象上执行多个任务的便捷方法。提示:jQuery 返回 jQuery 对象,与已传递的 DOM 对象不同。jQuery 对象拥有的属性和方法,与 DOM 对象的不同。您不能在 jQuery 对象上使用 HTML DOM 的属性和方法。
相关文章推荐
- POJ1679 The Unique MST(次小生成树)
- require(),include(),require_once()和include_once()区别
- 334. Increasing Triplet Subsequence
- Column ‘nature’ has duplicated value ‘婆婆妈妈’ in SET
- UCenter info: MySQL Query Error SQL:SELECT value FROM [Table]vars WHERE name=\'noteexists2′ Error:SELECT command denied to use
- Codeforces 645E Intellectual Inquiry (dp不同子序列计数)
- php图像函数 imagecreatetruecolor()和imagecreate()的区别
- dedecms添加新变量提示 Request var not allow
- iOS 之 UITableViewCell 分割线左边没有顶格 解决方法
- hdu1159 Common Subsequence--DP
- 300. Longest Increasing Subsequence
- JS生成GUID和传参乱码
- UITableViewCell的四种样式
- 解决php5.3中Deprecated: Assigning the return value of new by reference is deprecated in报错
- {html_options options=$item.options selected=$item.value}
- 62. Unique Paths
- QuickStart with RHOS(Red Hat OpenStack) Folsom Preview
- smarty truncate 用法 {$articleTitle|truncate:30:\"...\":true}
- warning: incompatible implicit declaration of built-in function ‘strlen’
- iOS开发-代替UDID被弃用和UUID使用缺陷的解决方案