ch.2.pptx
ch.2.pptx
JQuery
Teaching by Prof. Shivani Kania
2.1 Introduction to JQuery, features
• The purpose of jQuery is to make it much easier to use JavaScript on your
website.
• HTML
• CSS
• JavaScript
• 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.
• HTML/DOM manipulation
• CSS manipulation
• HTML event methods
• Effects and animations
• AJAX
• Utilities
• Why jQuery?
There are lots of other JavaScript libraries out there, but jQuery is
probably the most popular, and also the most extendable.
Many of the biggest companies on the Web use jQuery, such as:
• Google
• Microsoft
• IBM
• Netflix
• Features
Features provided by jQuery include:
• $("button").click(function(){$("img").attr("width","500");});
• Code in VScode
• Illustration explained:
• The next chapters will show us how to travel up, down and sideways
in the DOM tree.
DOM Methods
• Document Object Model (DOM) - is a W3C (World Wide Web
Consortium) standard that allows us to create, change, or remove
elements from the HTML or XML documents.
Events
• All the different visitors' actions that a web page can respond to are called
events.
• Examples:
• click()
• The function is executed when the user clicks on the HTML element.
• The following example says: When a click event fires on a <p> element; hide the
current <p> element
• code in VS code
• jQuery – Utilities
• css("propertyname");
• Code in VS code
• jQuerywidgets
• jQuery widgets are specialized, platform-independent, cross-browser
compatible, stateful plugins with a full life cycle and certain methods
and events, built on an extensible foundation known as the jQuery UI
Widget Factory.
• And when combined with animated visual effects, CSS, HTML, and
jQuery themes build a comprehensive jQuery UI, bringing JavaScript
and HTML UI creation to a whole new level and propelling it to the
top of the JavaScript UI framework charts.