Download JQuery Cheat Sheet [Part 2] for your Quick Reference Free Download

Disclosure: Hackr.io is supported by its audience. When you leverage direct links happening our site, we English hawthorn earn an affiliate commission.



Table of Contents

  • JQuery Cheat Mainsheet PDF

Welcome to the second share of Hackr's jQuery Swindle Tack. This covers the AJAX, Attribute/CSS, Manipulation, and Traversing parts of jQuery. Intelligent? Here we go past:

JQuery Cheat Sheet PDF

P.S. - Eff how to learn JavaScript speedily.

AJAX

Global Ajax Effect Handlers

  • .ajaxComplete(handler) - Registers an event coach that is to be called when AJAX requests realized.
  • .ajaxError(handler) - Registers an result handler that is to comprise titled when AJAX requests complete with an error.
  • .ajaxSend(manager) - Adds a social function that is to be executed before an AJAX request is sent.
  • .ajaxStart(animal trainer) - Registers an event manager that is to be named when the first Ajax request begins.
  • .ajaxStop(coach) - Registers an consequence handler that is to be called when all AJAX requests have been completed.
  • .ajaxSuccess(handler) - Registers an upshot manager that is to comprise called when an AJAX request completes successfully.

Helper Functions

  • jQuery.param(obj)/jQuery.param(obj, traditional) - Creates a serialized representation of an array or a jQuery objective suitable to use in a URL query string or an Ajax bespeak. When a jQuery object is passed, it moldiness contain input elements with name/economic value properties.
  • .serialize() - Encodes a set of form elements A a string for submission.
  • .serializeArray() - Encodes a set of fles elements atomic number 3 an range of names and values.

Low-Level Port

  • jQuery.Ajax(url [, settings])/jQuery.Ajax([settings]) - Performs an AJAX, anachronous HTTP, request.
  • jQuery.ajaxPrefilter([dataTypes], handler) - Handles custom AJAX options or alter active options ahead from each one call for is sent and the same is cured by $.Ajax().
  • jQuery.ajaxSetup(options) - Sets nonpayment values for future AJAX requests.
  • jQuery.ajaxTransport(dataType, handler) - Creates an object that handles the transmission of AJAX information.

Shorthand Methods

  • jQuery.get(uniform resource locator [, data][, success][, dataType])/jQuery.get([settings]) - Loads information from the server using an Hypertext transfer protocol GET request.
  • jQuery.getJSON(url [, information][, succeeder]) - Loads JSON-encoded data from the server using an HTTP GET call for.
  • jQuery.getScript(url [, success]) - Loads and executes a JS file from the server victimisation an HTTP GET bespeak.
  • jQuery.post(url [, data][, success][, dataType])/jQuery.post([settings]) - Rafts information from the server using an HTTP POST request.
  • .encumbrance(url [, data][, complete]) - Loads data from the host and place the returned HTML into the matched elements.

ATTRIBUTES/CSS

Attributes

  • .attr() - Gets the value of an property for the offse element among the set of matching elements or sets one surgery many attributes for every matched element. Its variations are:
  • attr(attributeName)
  • attr(attributeName, value)/attr(attributes)/attr(attributeName, function)
  • .prop() - Gets the value of a property for the first element among the set of matching elements or sets one or many properties for each of the matching elements. Its variations are:
  • .prop(propertyName)
  • .prop(propertyName, value)/.prop(properties)/.prop(propertyName, function)
  • .removeAttr(attributeName) - Removes an attribute from each of the elements among the located of matching elements.
  • .removeProp(propertyName) - Removes a property from the hard of twinned elements.
  • .val()/.val(function)/.val(value) - Gets the present value of the first element among the put off of matching elements or sets the value of all matching constituent.

CSS

  • .addClass(className)/.addClass(function) - Adds the specified class(E) to every element among the set of twin elements.
  • .css() - Gets the value of a computed style property for the first element among the position of matched elements or sets one or many CSS properties for apiece of the matching elements. Its variations are:
  • .css(propertyName)/.css(propertyNames)
  • .css(propertyName, value)/.css(propertyName, social function)/.css(properties)
  • jQuery.cssHooks - Offers a way for shaping functions for getting and setting particular CSS values. It send away also be used for creating untested cssHooks for normalizing CSS3 features.
  • jQuery.cssNumber - It is an object containing all CSS properties useable without a unit.
  • Note : The targe is ill-used aside the .css() method acting to check whether there is a need to add px to unitless values.
  • jQuery.escapeSelector(selector) - Escapes a character that has a special meaning in a CSS selector.
  • .hasClass(className) - Checks whether some of the matching elements are assigned to the specified class.
  • .removeClass([className])/.removeClass(function) - Removes one, many, or all classes from each ingredient among the go under of the matching elements.
  • .toggleClass() - Adds surgery removes ane surgery many classes from every element among the set of matching elements depending along the value of the state argument or the mien of the class. Its variations are:
  • .toggleClass(className)/.toggleClass(className, nation)/.toggleClass(function [, state])
  • toggleClass([state])

Dimensions

  • .height()/.summit(function)/.height(treasure) - Returns the present computed height for the number 1 element among the adjust of one-to-one elements or sets the tallness of all matching component.
  • .innerHeight()/.innerHeight(office)/.innerHeight(measure) - Returns the current computed inner height for the first base element among the set of matching elements or sets the central height of every matching element.
  • .innerWidth()/.innerWidth(function)/.innerWidth(value) - Returns the current computed inner width for the first element among the set of matching elements or sets the inner breadth of apiece matching factor.
  • .outerHeight([includeMargin])/.outerHeight(procedure)/.outerHeight(value [, includeMargin]) - Returns the present computed external height for the archetypal element among the gear up of matching elements or sets the outer height of each matching component.
  • .outerWidth([includeMargin])/.outerWidth(function)/.outerWidth(economic value [, includeMargin]) - Gets the current computed satellite width for the first element among the set of matching elements or sets the outer width of each matching element.
  • .width()/.width(subroutine)/.width(value) - Returns the present computed width for the eldest element among the lay out of co-ordinated elements Beaver State sets the width of every twinned element.

Offset

  • .offset()/.offset(coordinates)/.offset(function) - Returns the current coordinates of the first element among the set of coordinated elements or sets the coordinates of each ingredient.
  • .offsetParent() - Gets the closest positioned ancestor element.
  • Note : An element is called positioned if it has a CSS position ascribe of absolute, rigid, or relative.
  • .position() - Gets the new coordinates of the ordinal element among the put together of matching elements w.r.t. to the offset parent.
  • .scrollLeft()/.scrollLeft(value) - Gets the actual horizontal position of the gyre bar for the first element among the set of matching elements or sets the horizontal position of the scroll bar for each of the matching elements.
  • .scrollTop()/.scrollTop(value) - Gets the present-day vertical position of the scroll bar for the first element among the set of matching elements or sets the vertical position of the scroll bar for each of the matching elements.

Information

  • jQuery.information(constituent)/jQuery.information(element, key)/jQuery.information(constituent, key, value) - Stores the discretional data associated with the passed element and/Beaver State returns the value that was set.
  • .data()/.date(key)/.data(obj)/.data(key, rate) - Stores arbitrary data associated with the twin elements or returns the value at the named information store for the first element among the set of matching elements.
  • jQuery.hasData(element) - Checks the mere element for some associated jQuery data.
  • jQuery.removeData(element [, name]) - Removes a specified data from the passed element.
  • Bill : Low-floor method. Exploitation the .removeData() method acting is recommended.
  • .removeData([name])/.removeData([leaning]) - Removes a specified data from the passed constituent.

MANIPULATION

Copying

  • .clone([withDataAndEvents])/.knockoff([withDataAndEvents][, deepWithDataAndEvents]) - Creates a deep written matter of the Set of the matching elements.

DOM Insertion, Around

  • .wrap(function)/.wrap(wrappingElement) - Wraps an Hypertext mark-up language structure around all element among the set of matching elements.
  • .wrapAll(function)/.wrapAll(wrappingElement) - Wraps an HTML structure around all elements among the set of matching elements.
  • .wrapInner(social occasion)/.wrapInner(wrappingElement) - Wraps an HTML structure around the content of every ingredient of the set of the duplicate elements.

DOM Inspection, Wrong

  • .append(function)/.supplement(content [, content]) - Inserts self-satisfied specified by the passed parameter to the end of every element among the dictated of matching elements.
  • .appendTo(objective) - Inserts each element of the set of matching elements to the end of the mere target.
  • .html()/.html(subprogram)/.hypertext markup language(htmlString) - Gets the HTML contents of the world-class constituent among the set of matching elements or sets the HTML contents of from each one of the matching elements.
  • .prepend(content [, contented])/.prepend(procedure) - Inserts content specified by the passed parameter to the beginning of every factor among the set of coordinated elements.
  • .prependTo(target) - Inserts each element in the set of matching elements to the beginning of the specified target.
  • .schoolbook()/.textbook(social function)/.text(text) - Gets the combined text contents of every ingredient among the set of matching elements, including the descendants, or sets the school tex content of all matching element.

DOM Introduction, Outside

  • .after(content [, content])/.after(function)/.after(function-html) - Inserts specified cognitive content after all element among the set of matching elements.
  • .in front(contentedness [, content])/.before(social occasion)/.before(function-html) - Inserts specified content before every element among the fit of the matched elements.
  • .insertAfter(aim) - Inserts each factor in the set of matched elements after the specified target.
  • .insertBefore(target) - Inserts from each one element in the set of matching elements before the nominative target.

DOM Removal

  • .detach([selector]) - Removes all the matching elements from the DOM.

Notation : The method is similar to the .murder() method, with the exception that the former retains all of the jQuery information associated with the abstracted elements. Therefore, it is useful in scenarios requiring reinserting the remote elements into the DOM sometime later.

  • .empty() - Removes all the baby nodes of the matching elements from the DOM.

Billet : As per the DOM specification, any text string within an element is considered a child node of that uncommon ingredient. Hence, the method also removes any text within the set of matching elements.

  • .remove([selector]) - Removes all the matched elements from the DOM.
  • .give away()/.unwrap([selector switch]) - Removes and replaces the parent nodes of all the matching elements from the DOM with the matching elements.

DOM Transposition

  • .replaceAll(target) - Replaces each of the nominative target elements with the set of duplicate elements.
  • .replaceWith(newContent)/.replaceWith(function) - Replaces every ingredient among the set of matching elements with the nominative content and returns the set of removed elements.

TRAVERSING

Filtering

  • .eq(indicant)/.equivalent(indexFromEnd) - Constructs a freshly jQuery objective from the element specified by the passed index.
  • .filter(selector)/.filter out(office)/.filter(elements)/.filter(selection) - Reduces the set of twin elements to those elements that tally the specified selector, jQuery object, element(s), operating room pass the specific function.
  • .eldest() - Constructs a new jQuery object from the first element among the set of the matching elements.
  • .has(selector)/.has(contained) - Reduces the nonmoving of matching elements to those elements that have a descendent element duplicate the specified selector switch Beaver State the specified DOM element.
  • .is(chooser)/.is(routine)/.is(selection)/.is(elements) - Checks the electric current set of co-ordinated elements against a specified picker, ingredient(s), jQuery aim, or function and returns true if leastwise incomparable of the elements matches the specified arguments.
  • Note : This method, unlike other filtering methods, doesn't create a New jQuery object. Thus, it allows testing the table of contents of a jQuery object without modification. This makes IT useful for using inside callbacks.
  • .last() - Reduces the set of matching elements to the most recently element of the identical.
  • .map(recall) - Returns a new jQuery targe containing the return values resulting by departure every element in the current put of matching elements through a function.
  • .not(selector)/.not(work)/.not(selection) - Constructs and returns a new jQuery objective from a subset of matching elements containing elements that don't pass the specified selector, element(s), or function's examine.
  • .slice(start [, end]) - Reduces the coiffur of matching elements to a subset specified by a range of indices.

Miscellaneous Traversing

  • .add(selector)/.hyperkinetic syndrome(elements)/.minimal brain damage(html)/.add(selection)/.minimal brain dysfunction(selector, context) - Creates and returns a new jQuery object containing the matching elements and those passed using a selector, element(s), HTML snippet, operating room jQuery object.
  • .addBack([selector]) - Adds the previous sic of elements along the quite a little to the current set of elements, optionally filtered using a selector.
  • .contents() - Constructs and returns a new jQuery object containing the child nodes of to each one element, including textual matter nodes, commentary nodes, and HTML elements, among the set of matching elements.
  • .each(function) - Iterates over a jQuery object and executes the specific function happening every coordinated component.
  • .end() - Ends the most recent filtering operation on the present-day mark of elements and returns the previous states (values) of the matched elements.

Tree Traversal

  • .children([chooser]) - Constructs and returns a new jQuery object containing the child nodes of every element among the set of matching elements.

Note : The method acting is different from the .witness() method in the agency that the latter tail end traverse down multiple levels to choice grandchildren, zealous-grandchildren, etc. It is also similar to the .contents() method with the exclusion that the .contents() method besides selects textual matter nodes, comments nodes, and HTML elements.

  • .closest(selector)/.closest(selector [, context])/.closest(selection)/.closest(element) - Constructs and returns a bran-new jQuery object containing elements filtered using the specified picker, element(s), or a jQuery object from the set of matching elements and their ancestors in the DOM tree.
  • .find(selector)/.find(element) - Gets the descendants of all element in the current set of matching elements, filtered using a selector, element(s), or a jQuery aim.
  • .next()/.close([chooser]) - Gets the at once following sibling of every element in the lay out of matching elements, optionally filtered by a selector expression.
  • .nextAll()/.nextAll([selector]) - Gets whol the following siblings of every component among the dictated of co-ordinated elements, optionally filtered using a selector.
  • .nextUntil([selector][, permeate])/.nextUntil([element][, dribble]) - Gets all the following siblings of all element from the set of matching elements and continuing until sexual climax crossways an element matched by the specified DOM guest, selector switch, Oregon jQuery aim.
  • .nurture()/.parent([selector]) - Gets the parent node of all element among the set of twin elements, optionally filtered using a selector aspect.
  • .parents()/.parents([selector]) - Gets the ancestors of every element among the put on of matching elements, optionally filtered by a selector switch expression.

Note : The difference between the .parent() method and .parents() method is that the former exclusively traverse a unmated level up the DOM tree.

  • .parentsUntil([chooser][, trickle])/.parentsUntil([element][, filter]) - Gets the ancestors of all element from the set of matching elements and continuing until coming across an element matched away the specified DOM node, jQuery object, or selector construction.
  • .prev()/.prev([selector]) - Constructs and returns a new jQuery targe containing the immediately preceding sibling, optionally filtered past a selector expression, of every element among the set of matching elements.
  • .prevAll()/.prevAll([selector]) - Gets all the preceding siblings of every element among the set of matching elements, optionally filtered using a selector expression.
  • .prevUntil([selector][, filter])/.prevUntil([element][, filter]) - Continues getting the prior siblings of all element from the set of matching elements until coming across an element matched by the specified DOM node, jQuery object, or selector expression.
  • .siblings()/.siblings([picker]) - Constructs and returns a jQuery object containing all the siblings of all element belonging to the gear up of the matching elements, optionally filtered using a selector expression.

Conclusion

With that, we're through with the jQuery Cheat Sheet Part - II. I hope you will find it useful when leveraging jQuery in your code, erudition jQuery, or doing anything requiring intelligent jQuery reference. Can't find something you were looking for? Try jQuery Cheat Mainsheet Part - I.

Spotted any misinformation? Let us eff via comments and so that we can buoy mend IT ASAP and better this jQuery Cheat Sheet. Thanks in advance!

You can download jQuery Cheat Sheet Deuce from here.

Multitude are also reading:

  • JQuery Question Questions and Answers
  • Download Bootstrap Cheat Sheet
  • Download C# Cheat Sheet
  • Download MySQL Slicker Canvas
  • Download Linux Cheat Sheet
  • Download Rotter Cheat Tabloid
  • Download CSS Cheat Sheet
  • Download PHP Cheat Weather sheet
  • Download HTML Cheat Sheet
  • Download SQL Cheat Sheet
  • Download Java Cheat Sheet

Akhil Bhadwal

Akhil Bhadwal

A Computing machine Science fine-tune interested in mixing up imagination and knowledge into enticing words. Been in the big bad world of content writing since 2014. In his free time, Akhil likes to play cards, do guitar jam, and write weird fiction. View all posts by the Author

DOWNLOAD HERE

Download JQuery Cheat Sheet [Part 2] for your Quick Reference Free Download

Posted by: mcnealforejusell1959.blogspot.com

0 Komentar

Post a Comment




banner