1. jQuery对象-->Dom对象
1) 通过 .[0] 的方式:
var $s = $(.class); (jQuery对象)
var s = $s.[0]; (Dom对象)
2) 通过 jQuery本身提供的方法: .getIndex(0) 的方式:
var $s = $(.id); (jQuery对象)
var s = $s.getIndex(0); (Dom对象)
2. Dom对象-->jQuery对象
1) 通过 .[0] 的方式:
var $s = $(.class); (jQuery对象)
var s = $s.[0]; (Dom对象)
2) 通过 jQuery本身提供的方法: .getIndex(0) 的方式:
var $s = $(.id); (jQuery对象)
var s = $s.getIndex(0); (Dom对象)
2. Dom对象-->jQuery对象
通过 $(dom对象) 的方式:
var s = document.getElementById(id); (Dom对象)
var $s = $(s); (jQuery对象)
var s = document.getElementById(id); (Dom对象)
var $s = $(s); (jQuery对象)