jQuery example
jQuery Example
Do you want to improve your jQuery skills?
jQuery Selector
$(this).hide()
Demonstrate jQuery's hide() function to hide the current HTML element.
$("p").hide()
Demonstrates jQuery's hide() function to hide all <p> elements.
$(".test").hide()
Demonstrates jQuery's hide() function to hide all elements with class="test".
$("#test").hide()
Demonstrates jQuery's hide() function to hide elements with id="test".
jQuery event
jQuery click()
Demo jQuery jQuery click() event.
jQuery dblclick()
Demo jQuery dblclick() event.
jQuery mouseenter()
Demonstrates the jQuery mouseenter() event.
jQuery mouseleave()
Demonstrates the jQuery mouseleave() event.
jQuery mousedown()
Demonstrates the jQuery mousedown() event.
jQuery mouseup()
Demonstrates the jQuery mouseup() event.
jQuery hover()
Demonstrates the jQuery hover() event.
jQuery focus() and blur()
Demonstrates jQuery focus() and blur() events.
Example analysis
##jQuery Hide/Show
Demonstrates the jQuery hide() method.
Demonstrates the jQuery hide() and show() methods.
jQuery toggle() is used to switch hide() and show() methods.
Another example of hiding text.
##jQuery fade in and fade out
jQuery fadeIn()
jQuery fadeOut()
jQuery fadeToggle()
jQuery fadeTo()
Example analysis
##jQuery sliding
jQuery slideDown()
Demonstrates the jQuery slideDown() method.
jQuery slideUp()
Demonstrates the jQuery slideUp() method.
jQuery slideToggle()
Demonstrates the jQuery slideToggle() method.
Example analysis
##jQuery animation
jQuery animate() Demonstrates the simple jQuery animate() method.
jQuery animate() - Setting multiple css properties
Demonstrates changing styles through the jQuery animate() method.
jQuery animate() - Using related values
Demonstrates how to use related values in the jQuery animate() method.
jQuery animate() - Using predefined values
Demonstrates predefined "hide", "show", "toggle" values through the animate() method.
jQuery animate()
Demonstrate more jQuery animate() method examples
jQuery animate()
Demonstrate more jQuery animate() method examples (multiple animate() Callback).
Example analysis
jQuery stop animation
jQuery stop() Slide
Demo jQuery stop( ) method.
jQuery stop() animation (with parameters)
Demonstrates the jQuery stop() method.
Example analysis
##jQuery HTML acquisition and attributes
Use jQuery text() and html() methods to get content.
Use the jQuery val() method to get the field value of the form.
Use jQuery attr() method to get attribute value.
jQuery HTML setting content and attributes
Use jQuery text(), html() and val() methods to set content.
Use text() and html() to set the content and use the callback function
Use the jQuery attr() method to set the attribute value.
Use the jQuery attr() method to set multiple attribute values.
Set the attribute value + and use the callback function to call attr().
jQuery HTML Add element/content
In selecting elements Add content at the end
Add content at the beginning of the selected element
Innovate new text/HTML elements, jQuery and JavaScript/DOM. Appended after the text of the new element.
Add HTML elements before and after the selected element.
Innovate new text/HTML elements, jQuery and JavaScript/DOM. Inserts a new element at the end of the selected elements.
##jQuery HTML remove element/content
jQuery remove()
jQuery empty()
jQuery remove() - Filter elements using parameters
Instance parsing
##jQuery Get and set CSS classes
Add class attributes to different elements
Use the addClass() method to add multiple classes
Remove the specified element Class
Toggle (add/delete) class in the selected element
jQuery css() method
Returns the css of the first matching element Property value
Set CSS properties specified by all configuration elements
Set multiple matching elements CSS properties
##jQuery size
jQuery - Returns width() and height()
jQuery - Returns innerWidth() and innerHeight()
jQuery - Returns outerWidth() and outerHeight()
jQuery - Returns outerWidth(true) and outerHeight(true)
jQuery - Return width() and height() of document and window
jQuery - Set width() and height()
Instance analysis
jQuery Traversal - Ancestors
jQuery parent()
jQuery parents()
jQuery parentsUntil()
Example Analysis
##jQuery Traversal - Descendants
jQuery children()
Demonstrates the jQuery children() method.
jQuery find()
Demonstrates the jQuery find() method.
Example Analysis
##jQuery Traversal - Siblings
jQuery siblings() Demonstrates the jQuery siblings() method.
Demonstrates the jQuery next() method.
Demonstrates the jQuery nextAll() method.
Demonstrates the jQuery nextUntil() method.
##jQuery AJAX load() method
jQuery load()Load the file content asynchronously and insert it into the <div> element.
jQuery load()
jQuery load() - Using the callback function (callback)
Use the callback function of the jQuery load() method.
Example analysis
##jQuery AJAX get() and post() methods
Use the $.get() method to asynchronously obtain data from the server
Use the $.post() method Asynchronously obtain data from the server