$(this) returns a jQuery object, on which you can call several jQuery methods e.g. text() to retrieve text, val() to retrieve value etc, while this represent current element, and it’s one of the JavaScript keyword to denote current DOM element in a context. You can not call jQuery method on this, until it’s wrapped using $() function i.e. $(this).

Example:

$(document).ready(function(){
    $('#DivValue').mouseover(function(){
       alert($(this).text());
  });
});

////**************////

$(document).ready(function(){
    $('#DivValue').mouseover(function(){
       alert(this.innerText);
  });
});

The difference between ID and class selector, It is same with jQuery. ID selector uses ID e.g. #element-id to select element, while class selector uses CSS class to select elements. When you just need to select only one element, use ID selector, while if you want to select a group of element, having same CSS class than use class selector.

  1. Easy to use and learn.
  2. Easily expandable.
  3. Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)
  4. Easy to use for DOM manipulation and traversal.
  5. Large pool of built in methods.
  6. AJAX Capabilities.
  7. Methods for changing or applying CSS, creating animations.
  8. Event detection and handling.
  9. Tons of plug-ins for all kind of needs.

The $() function is an alias of jQuery() function, at first it looks weird and makes jQuery code cryptic, but once you get used to it, you will love it’s brevity. $() function is used to wrap any object into jQuery object, which then allows you to call various method defined jQuery object. You can even pass a selector string to $()function, and it will return jQuery object containing an array of all matched DOM elements. I have seen this jQuery asked several times, despite it’s quite basic, it is used to differentiate between developer who knows jQuery or not.