$(this) 和 this
在使用 jQuery 时,$(this) 和 this 具体指:
this :是当前 DOM 对象;
$(this) 是jQuery对象;
例子:
<input type="text">
$(function(){
$("#search_id").focus(function(){
alert(this); //弹出值为: object HTMLInputElement
alert($(this)); //弹出值为:object object
})
})
jQuery 对象和 DOM 对象 是可以相互转化的 : jQuery ($varJD) 转DOM (JD) :JD=$varJD[0] ; JD=$varJD.get(0) 。DOM (JD)转 jQuery ($varJD):$varJD=$(JD);
可以带入上边验证:$(this)[0],将会弹出 object HTMLInputElement。
随机推荐
- Easy UI treegrid 分页实例
转自:http://www.jeasyuicn.com/jquery-easyui-treegird-page-processing.html
- 【FSFA 读书笔记】Ch 2 Computer Foundatinons(2)
Hard Disk Technology 1. 机械硬盘内部构造 几个重要概念:Sector(扇区),Head(读写头),Track(磁道),Cylinder(柱面). 如果一个文件比较大,磁盘的写入 ...
- poj 3287 The Trip, 2007_贪心
题意:把一个包放入另一个包内,使得总共要带的件数最少,就是说大包可以装小包,且一个大包只能装一个小包,但是这个小包可以继续装更小的包. 思路:因为相同大小的包不能互相装,所以最小数量就是有相同尺寸的包 ...
- hdu 1754 I Hate It_线段树
题意:略 思路:套hdu1166模版改改就行了,要注意的是,网上有的代码是错的,还贴出来... #include <iostream> #include<cstdio> #in ...
- 《编写高质量代码 改善Java程序的151个建议》书摘
例子1:三元操作符的陷阱 int i = 80; String str1 = String.valueOf(i < 100 ? 90 : 100); String str2 = String.v ...
- hdu 4740 The Donkey of Gui Zhou(dfs模拟好题)
Problem Description There was no donkey ,) , the down-right cell ,N-) and the cell below the up-left ...
- Avoid The Lakes
Avoid The Lakes Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other) To ...
- Walking Ant(一道有意思的蚂蚁游戏,bfs)
Walking Ant Time Limit: 2 Seconds Memory Limit: 65536 KB Ants are quite diligent. They sometime ...
- ios 第三方qq授权登陆,第一次登陆后,再次登陆,失效
这问题找了非常久.最后跟客服联系到.等授权成功后要对 _tencentOAuth 对象释放
- [每日一题] 11gOCP 1z0-052 :2013-09-19 创建用户...................................................B41
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/11834661 正确答案:BC 这道题比较简单,我就以答案来解析,如下来自官方文档创建用户的 ...