-1

I am relatively new to Javascript and Jquery. I've been looking through some code for a potential project and I see constant use of '$'. Through the context I can get an idea of what it means, but I don't have enough of a grasp to understand how to manipulate it.

For example, this line seems to take the csv file and returns a string variable called data with the contents of the csv file. But I don't understand how or why it does that.

$.get('browserData.csv', function(data)){

How do people familiar with Jquery effectively use the '$'?

Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125
YazanLpizra
  • 520
  • 1
  • 11
  • 32

2 Answers2

3
$("JustaboutAnything");// As a selector
$.get("afile"); // Rendering Ajax
$(function();// Declaring Document Ready

This is question is not specific.

Like @BLGT said, $ is an alias for the jQuery library object (aka. namespace)

http://api.jquery.com/

Mark
  • 4,773
  • 8
  • 53
  • 91
2

The dollar sign

The first $ is a shorthand for the jQuery() function, the jQuery object constructor.

In other words, it's a variable called $ that's been assigned a function called jQuery, as can been seen in the unminified version of the jQuery file: window.jQuery = window.$ = jQuery;

From here

TL;DR: It's shorter than writing "jQuery" all the time. You use it everytime you want access to jQuery specific functionality.

Community
  • 1
  • 1
Marius P.
  • 322
  • 6
  • 13