jQuery gives Web developers Because jQuery is so easy to implement.Facebook and Twitter, for example.An easy way to create sophisticated
effects with almost no coding.jQuery lets you easily change the appearance, location, or behavior of an
element on a Web page.
1.<!doctype...>: This long element tellsthe Web browser which version of HTML isused in the code that follows. You shouldalways include it at the beginning of any
HTML pages you create.
2.<html>: This element begins the HTMLpage.
3.: This element designates thebeginning of the head section. This sectionusually contains the title and any script element.
4. My Test Page:This line displays the title of the page.
5.
min.js”>: This line provides the location of the jQuery library.
6.
script”>: This script tag tells the browser that everything inside is JavaScript code.
7.$(document).ready(function(){:The dollar sign is an alias for the jQuery function. The ready function waits for the Web page to load, and then the code contained inside it is executed.
8.a l e r t ( j Q u e r y ( ‘ i m g ’ ) .attr(‘height’));: The alert function opens a pop-up alert box. The dollar sign that follows is calling the jQuery attr function. This function returns the value of whatever attribute is in quotes, in this case, the height. Notice that img precedes the attr function. In short, this function means, “look for all img elements you find in the HTML code, and return the value of the height attribute of the first one.”
9.});: This punctuation is closing the braceand parenthesis started in the $(document).ready(function(){ line
10.: This tag closes the
effects with almost no coding.jQuery lets you easily change the appearance, location, or behavior of an
element on a Web page.
1.<!doctype...>: This long element tellsthe Web browser which version of HTML isused in the code that follows. You shouldalways include it at the beginning of any
HTML pages you create.
2.<html>: This element begins the HTMLpage.
3.: This element designates thebeginning of the head section. This sectionusually contains the title and any script element.
4.
5.
min.js”>: This line provides the location of the jQuery library.
6.
script”>: This script tag tells the browser that everything inside is JavaScript code.
7.$(document).ready(function(){:The dollar sign is an alias for the jQuery function. The ready function waits for the Web page to load, and then the code contained inside it is executed.
8.a l e r t ( j Q u e r y ( ‘ i m g ’ ) .attr(‘height’));: The alert function opens a pop-up alert box. The dollar sign that follows is calling the jQuery attr function. This function returns the value of whatever attribute is in quotes, in this case, the height. Notice that img precedes the attr function. In short, this function means, “look for all img elements you find in the HTML code, and return the value of the height attribute of the first one.”
9.});: This punctuation is closing the braceand parenthesis started in the $(document).ready(function(){ line
10.: This tag closes the