1.2 Identify Javascript and jQuery programming concepts

Review jQuery api docs. Review Drupal.behaviors.

jQuery is a feature rich JavaScript library that simplifies accessing JavaScript functions to reduce code duplication. Drupal use to come with jQuery a part of Drupal core.

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

https://www.drupal.org/docs/8/api/javascript-api/javascript-api-overview

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:

<ul>
<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>
</ul>

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

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

OR

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

.slideToggle( [duration ] [, complete ] )

Other Resources