• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The $ operator in jquery

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm learning JavaScript and can't figure out what's the $ used in nearly all scripts that use jquery.

I couldn't find $ in the operators section in w3schools tutorials, so perhaps I was wrong to presume it is a built-in operator. The way it's used sure looks like it's an operator.

Any help appreciated.

Thanks,
Ubuuntu
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It has nothing to do with built in JavaScript functionality/methods. $ is a function that returns a jQuery object.

It is a more robust version of



You can always read through the un minimized version of the jQuery code to understand it.

Eric
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Ub Uuntu", please check your private messages for an important administrative matter.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ub Uuntu wrote:I couldn't find $ in the operators section in w3schools tutorials, so perhaps I was wrong to presume it is a built-in operator.


It's not a built-in operator any more than any other name introduced in the namespace is an operator. It's just a name like xyz, or fred, or whateverYouCallSomething.

The $ is a valid character to use in a name in JavaScript just like alphabetics, numerics and the underscore.

jQuery defines the $ as an alias for its jQuery function.

The way it's used sure looks like it's an operator.


Not really. The ways that it's used it looks like a function, because that's what it is.
 
Meerkat Hossenphfephfer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Thanks, that clears it up.

ubuuntu
 
reply
    Bookmark Topic Watch Topic
  • New Topic