1.2 Identify Javascript and jQuery programming concepts

Review jQuery api docs. Review Drupal.behaviors.

jQuery is no longer automatically enabled with Drupal 8 you must specify that you want jQuery and what version you wish to use.


Review the jQuery Api docs for examples of jQuery methods.

For Example:

The jQuery method .filter() reduces the set of matched elements to those that match the selector or pass the function's test. Consider a page with a simple list on it:

  <li>list item 1</li>
  <li>list item 2</li>
  <li>list item 3</li>
  <li>list item 4</li>
  <li>list item 5</li>
  <li>list item 6</li>

We can apply this method to the set of list items:

$( "li" ).filter( ":even" ).css( "background-color", "red" );


Another jQuery method example would be slidetoggle. Display or hide the matched elements with a sliding motion.

 .slideToggle( [duration ] [, complete ] )

Other Resources

Last updated