jQuery

jQuery is a JavaScript Library. jQuery greatly simplifies JavaScript programming and it is easy to learn. Referencing jQuery is extremely easy and there are multiple ways to do it.
jQuery is a lightweight, “write less, do more”, JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on your website. jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code. jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation. The jQuery library contains the following features:

  • HTML/DOM manipulation
  • CSS manipulation
  • HTML event methods
  • Effects and animations
  • AJAX

Adding jQuery to Your Web Pages

There are several ways to start using jQuery on your web site. You can:

  • Production version – this is for your live website because it has been minified and compressed
  • Development version – this is for testing and development (uncompressed and readable code)

Both versions can be downloaded from jQuery.com. The jQuery library is a single JavaScript file, and you reference it with the HTML <script>tag (notice that the <script> tag should be inside the <head> section)

< head>
<script src=”jquery-3.2.1.min.js”></script>
</head>

jQuery Syntax

The jQuery syntax is tailor-made for selecting HTML elements and performing some action on the element(s). Basic syntax is: $(selector).action()

  • A $ sign to define/access jQuery
  • A (selector) to “query (or find)” HTML elements
  • A jQuery action() to be performed on the element(s)

Examples:

  • $(this).hide() – hides the current element.
  • $(“p”).hide() – hides all <p> elements.
  • $(“.test”).hide() – hides all elements with class=”test”.
  • $(“#test”).hide() – hides the element with id=”test”

Floating point numbers are also stored in a platform-specific range. They can be specified using floating point notation, or two forms of scientific notation.
PHP has a native Boolean type that is similar to the native Boolean types in Java and C++.
The null data type represents a variable that has no value; NULL is the only allowed value for this data type.
Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays

jQuery Event Methods

All the different visitor’s actions that a web page can respond to are called events. An event represents the precise moment when something happens. Examples:

  • moving a mouse over an element
  • selecting a radio button
  • clicking on an element

The term “fires/fired” is often used with events. Example: “The keypress event is fired, the moment you press a key”.
jQuery Syntax For Event Methods :
In jQuery, most DOM events have an equivalent jQuery method. To assign a click event to all paragraphs on a page, you can do this:

clkjquery

The next step is to define what should happen when the event fires. You must pass a function to the event:

clkjqury2

Commonly Used jQuery Event Methods
$(document).ready()
The $(document).ready() method allows us to execute a function when the document is fully loaded.

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

ezywebbuilding will use the information you provide on this form to be in touch with you and to provide updates and marketing.