$
is a function that can be called - $()
.
The behaviour of $()
varies immensely depending on the parameters supplied, although all examples below will return a jQuery
object. It can:
- register a
document.ready
handler - $(myfunc)
- act as a selector -
$('#myid')
- construct elements -
$('<div>')
- return an empty object -
$()
$
is also an object that contains various utility functions $.each
, etc as properties of that object. In this context, it acts like a namespace for those functions.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…