-2

Why sometimes I see the prefix jQuery( in javascript? Is there some differance to write jquery with this prefix jQuery( or without this prefix?

Liam
  • 27,717
  • 28
  • 128
  • 190
Ola
  • 1,188
  • 5
  • 16
  • 35

2 Answers2

3

It is a JavaScript library that simplifies the process of creating scripts that are compatible with a large number of browsers. It also has utility functions that simplify repetitive tasks.

You will also sometimes see $( which is just an alias for jQuery( because it's shorter to write. Furthermore, you may see some code that starts with $j( etc. Those are just other aliases that point to jQuery, but were named differently so that the code would not conflict with other jQuery code running on the page.

http://jquery.com/

Alex W
  • 37,233
  • 13
  • 109
  • 109
  • yes thats what I mean, sometimes I see $( and sometimes jQuery(. So they are the same? – Ola Apr 11 '14 at 13:23
  • 1
    @user1326231 They are the same if you only have jQuery on the page. The reason `jQuery(` is used is because sometimes other JavaScript libraries define their own functions called `$`, but you can be reasonably sure that only jQuery will define a function called `jQuery` – Alex W Apr 11 '14 at 13:29
0

I think you don't know about jQuery.

jQuery is a lightweight, "write less, do more", JavaScript library.

wherever you have seen this kind code, there they have used some jQuery code. jQuery itself using JavaScript. But code style is quite different.

Tuhin
  • 3,335
  • 2
  • 16
  • 27