Prog06- Joshua Mercier (jmmerci1)







jQuery vs JavaScript

  1. jQuery can prevent any jQuery code from running until the document is finished loading with the $(document).ready(function()); event which can be placed in the header or anywhere really. JavaScript instead uses onload which must be placed inside the body tag.
  2. jQuery uses selectors such as $ for elements, # for id's, and . for class's. Plain JavaScript must use a much more intensive amount of code to slect, such as i.e. document.getElementById() to grab an element of a certain Id.
  3. jQuery can use events in the script to keep Javascript, such as using the onclick="" attribute in the button element, outside of the body.
  4. jQuery can use .text() method to string out the entirety of an element, the text, html, values. Also allows for ease of setting values that JS would require more effort to do.
  5. jQuery can retrieve CSS style properties with ease with the .css() method. JS takes a bit more code to do the same.