title: Javascript: When to use a dollar sign before a variable name
body: <p>I cannot figure out the meaning of putting a dollar sign before certain variables.</p>
  
  <p>For example: $(document).ready <br>
  Another example: (function ($) {$.fn.aToast = function (options) {...</p>
  
  <p>Here is example code I found on the internet:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-type" content="text/xhtml;charset=UTF-8" &gt; 
          &lt;title&gt;jQuery test 2&lt;/title&gt;  &lt;h1&gt;jQuery test 2&lt;/h1&gt;&lt;hr&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt; 
      &lt;/head&gt;
      &lt;body&gt;
          &lt;button&gt;TEST1&lt;/button&gt;
          &lt;input type='button' 
              data-aToast='true' 
              data-aToast-text='TEST2 was pressed' 
              value='TEST2' 
          /&gt;
          
          &lt;div style='display:inline-block'&gt;&lt;br&gt;
          Here is Normal text in a &lt;b&gt;&amp;lt;div&amp;gt;&lt;/b&gt;&lt;/div&gt;
  
          &lt;script&gt;
              (function ($) {
                  $.fn.aToast = function (options) {
  
                  var $this = $(this),
                  settings = $.extend({
                      fadeOut: 400,
                      fadeIn: 400,
                      delay: 3000,
                      text: 'TEST1 was pressed',
                      toastListenEvent: 'click',
                      aClass: false
                  }, options),
                  $at = false,
                  aTevents = false;
  
                  settings.toastListenEvent = settings.toastListenEvent + ' a-Toast';
                  settings.aClass = 'aToast-view-message' + (settings.aClass ? ' ' + settings.aClass : '')
                  if ($('[data-aToast=true]:not(.aToast-init)').length) {
                      $this = $this.add($('[data-aToast=true]:not(.aToast-init)').addClass('aToast-init'));
                  }
                 
                  function _remove() {
                      $(this).stop().remove();
                  }
                 
                  function _displayDiv() {
                      $('.aToast-view-message').hide();
                      var $div = $('&lt;div/&gt;', {
                          text: $(this).data('atoast-text') ? $(this).data('atoast-text') : settings.text,
                          class: settings.aClass
                      }).stop().fadeIn(settings.fadeIn)
                          .delay(settings.delay)
                          .fadeOut(settings.fadeOut, _remove)
                          .appendTo('body');
                 
                      console.log($div[0]);
                  }
                 
                  $this.not('[data-aToast=false]').on(settings.toastListenEvent, _displayDiv);
                 
              };
          }(jQuery));
  
          $('button').aToast({
              aClass: 'x123' // users-dont-care-about-this-class-name'
          });
  
          $('div').aToast({
              aClass: 'Toast class',
              toastListenEvent: 'mouseenter',
              text: 'ERROR ... '
          });
  
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>