$(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。
随机推荐
- ios ViewController present不同的方向
			
First ViewController CATransition *transition = [CATransition animation]; transition.duration = 0.3; ...
 - PHP-xml-1
			
SimpleXML 解析xml 假设xml没有声明encoding默认使用utf-8进行解码.终于得到的数据编码为utf-8格式. 我猜想它内部实现了iconv(encoding='utf-8', ' ...
 - (原) Jquery 判断移动设备是IOS / Android系统
			
var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > - ...
 - 浏览器操作html页面的width和height
			
原文:http://www.cnblogs.com/dengshunping/archive/2009/06/15/1503803.html IE中: document.body.clientWidt ...
 - C#(VS2008)服务编写-安装和部署
			
1.创建一个空白解决方案. 2.在解决方案下面添加两个Windows服务:WXSmsGuardNew(保护服务),WXSmsMainNew(主服务). 3.第一个服务作为保护服务,服务上添加两个控件: ...
 - 关于oracle卸载没有卸载完全的问题
			
1.关闭oracle所有的服务.可以在windows的服务管理器中关闭: 2.打开注册表:regedit 打开路径: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlS ...
 - [IOS]图标尺寸
			
最新参考网址:https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Ico ...
 - zookeeper_00:zookeeper注意事项
			
需要将应用数据和协同数据独立开. 比如:网络邮箱服务的用户对自己邮箱中的内容感兴趣,但是并不关心由哪台服务器来处理特定邮箱的请求.在这个例子中,邮箱内容就是应用数据,而从邮箱到某一台邮箱服务器之间的映 ...
 - Android_CodeWiki_03
			
1.发送不重复的通知(Notification) public static void sendNotification(Context context, String title, String m ...
 - bootstrap简章
			
系统整理一遍bootstrap 的东西 1/ 设置页面为H5文档类型 <!DOCTYPE html> <html lang="zh-CN"> ... &l ...