Uploaded by alex wang

W4

advertisement
1
Week 4 Assignment
Sheng Wang
Westcliff University
DEV 640: Web Programming II
Prof. Tarik Iles
Mar 26, 2023
2
jQuery is a fast, small, and feature-rich JavaScript library which is simplest way to be
used in JavaScript to HTML, and that makes it easier to navigate HTML documents, handle
events, and create animations. Because it provides a simple, yet powerful syntax for selecting
and manipulating HTML elements, I am easily to get along to develop demos with jQuery.
Therefore, I will conclude some common jQuery syntax includes (jQuery Selectors n.d.).:
•
$(selector).action(): The $ symbol is used to define/access jQuery. The selector is used to
select HTML elements, and the action() method is used to perform some action on the
selected elements.
•
$(document).ready(function()): This is used to make sure that the entire HTML document
is loaded before any jQuery code is executed.
•
$(this): This is used to refer to the current HTML element in an event handler function.
jQuery selectors are used to select and manipulate HTML elements. Some common
jQuery selectors include (jQuery Selectors n.d.):
•
Element selectors: Select elements based on their tag name, such as $("p") to select all
paragraphs.
•
Class selectors: Select on their class name, such as $(".example") to select all elements
with class "example".
•
ID selectors: Select on their ID, such as $("#example") to select the element with ID
"example".
•
Attribute selectors: Select on their attribute, such as $("a[target='_blank']") to select all
links with target="_blank".
3
When working with jQuery, it's important to keep in mind that it's still JavaScript code
and can have performance issues if not written correctly. It's important to use jQuery only when
necessary and to avoid overusing it. In terms of struggling concepts, it's common to get confused
about the syntax and chaining of jQuery methods, as well as the different types of selectors and
their specific usage. It's important to practice using different selectors and methods to become
more familiar with them. On the other hand, the usefulness and convenience of jQuery selectors
and methods can really stand out when working with complex HTML documents and large-scale
web applications. It can significantly simplify code and save development time.
Overall, it's important to have a good understanding of jQuery syntax and selectors when
working with JavaScript and HTML, and to continue practicing and learning to improve
proficiency.
4
References
jQuery Syntax (n.d.). https://www.w3schools.com/jquery/jquery_syntax.asp
jQuery Selectors (n.d.). https://www.w3schools.com/jquery/jquery_selectors.asp
Nixon, R. (2021). Learning PHP, MySQL, and JavaScript: a step-by-step guide to creating
dynamic websites. " O'Reilly Media, Inc.".
Download