Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>jquery snippetsNew to Visual Studio Code? Get it now.
jquery snippets

jquery snippets

Abhi Patel

|
26,736 installs
| (17) | Free
jQuery Code Snippets for making easier to enter repeating code patterns, such as loops or conditional-statements in Visual Studio Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

jquery-snippets README

jQuery Code Snippets for making easier to enter repeating code patterns, such as loops or conditional-statements in Visual Studio Code

Requirements

jquery must be there.

Support

Supportable in all Visual Studio Code 1.58.0 or higher.

Release Notes

Contains over more than 200+ jQuery Snippets !!

Write Less, Code More 😜.

More snippets would be added. Currently, the extension is in the development mode. If you find any bug or have any suggestion/feature request, please write it in the Q&A section.

Get list of all available snippets by just writing the keyword 'js' only.

Command Desired Output
jsAdd Adds element to the selected element.
jsAddBack Adds previous set of elements to the selected element.
jsAddClass Adds the specified class/classes wherever it matches with the selected element.
jsAfter Inserts your desired content wherever it matches with the selected element.
jsAjax For performing an Asynchronous HTTP Ajax.
jsAjaxDoneFail For performing an Asynchronous HTTP Ajax with Done and Fail Condition.
jsAnimate Perform animation on the selected element by passing the parameters.
jsAppend Inserts your desired content for the specific value wherever it matches with the selected element.
jsAppendTo Insert your desired content wherever it matches with the selected element.
jsArrFindIndex Returns the index of the array element in the array.
jsArrIsArr Checks whether the passed value is an Array.
jsArrKeys Returns an Array Iterator object with the keys of an array.
jsArrPop Removes last element from an array and returns that element.
jsArrPush Adds new element at the end of an array and returns the new length of the array.
jsArrReduce Executes a reducer function for each value of an array.
jsArrReverse Reverses the order of elements in an array.
jsArrShift Removes the first element from an array and returns that removed element.
jsArrSome Checks if any of the elements in an array passes a user defined test and returns Boolean value.
jsArrSort Sorts the elements of an array in place and returns the sorted array.
jsArrUnshift Adds one or multiple elements to the beginning of an array and returns the new length of the array.
jsArrValues Returns a new Array Iterator object that contains the values for each index in the array.
jsArrayConcat Array Concat method does not change the existing arrays, but returns a new array, containing the values of the joined arrays.
jsBefore Inserts your desired content before the selected element.
jsBlur Event occurs when an element loses focus over the selected element.
jsCheckVisibility Checks whether the selected element is visible or hidden.
jsCheckboxRadioDisable Checkbox/Radio click event can be disabled.
jsChildren Return elements that are direct children of the selected element.
jsClassToggleSwitch Add or remove class/classes from each element in the set of selected match elements.
jsClearFormData Clear/Reset your whole Form Data.
jsClearQueue Removes all items from the queue that has not been run yet.
jsClick Click event occurs when the selected element is clicked.
jsClone Copy whole element wherever it matches with the selected elements.
jsClosest Returns first ancestor element of the selected element.
jsConAssert Prints an error message to the console if the assertion is false.
jsConClear Clears the console.
jsConDebug Prints an output message.
jsConError Prints an error message.
jsConLog Log output to console.
jsContains Checks whether the selected element contains the specified string or not.
jsContents Returns all children and nodes of the selected element.
jsCss Set css/multiple css value on the selected element.
jsData Attaches or get data of the selected element.
jsDataSetObj Returns data with the key-value pair.
jsDblClick Event fired when the selected element has been double clicked.
jsDeQueue Removes the next function from the queue and then executes funcitons after that.
jsDelay Sets a timer to delay the execution of the next function.
jsDelayRedirect Redirects to the new document after delayed interval.
jsDetach Removes the selected element along with its child and nodes too and also keeps copy of removed elements.
jsDocReady Executes function within it when the DOM is fully loaded.
jsEach A general iterator function that iterates through objects and arrays.
jsEachElement Iterate over object's and executes the function for each matched element.
jsElse Else Condition
jsElseIf Else If Condition
jsEmpty Remove all child nodes and content for the selected element.
jsEq Returns element with a specified index number of the selected element.
jsFadeIn To Fade in the hidden selected element.
jsFadeOut To Fade out the selected visible element.
jsFadeTo It gradually changes the opacity of the selected element to a specified opacity.
jsFadeToggle Does the vice versa i.e. if element fadeOut then makes it fadeIn
jsFilter Creates a filter for carrying out desired sorting on the selected array.
jsFind Return descendant elements wherever it matches with the selected element. Descendant element can be its child, grandchild and likely goes.
jsFinish Stops all the running as well as queued animations.
jsFirst Returns the first element of the selected element.
jsFocus Event fired when the selected element gets focus like by navigating to it.
jsFocusOut Event fired when the focus is removed from the selected element.
jsFunc Generate new function in javascript file.
jsGet Returns DOM elements of the selected element.
jsGetAttr Get attribute value of the selected element.
jsGetCheckboxRadioValId Get Checkbox/Radio Value by using Id.
jsGetCheckboxRadioValName Get Checkbox/Radio Value by using Name.
jsGetData Get data attribute value of the selected element set by using data-* attribute.
jsGetDataStatus Get data & status value for the parameter passed.
jsGetInputValue Get Selected Input Value.
jsGetIpAddress Get Client's Ip Address.
jsGetJson Gets JSON Data using an Ajax HTTP Get method.
jsGetScript Get and execute a JavaScript using an AJAX HTTP GET request.
jsGetSelectedOptionText Get Selected Option Text.
jsGetSelectedOptionVal Get Selected Option Value.
jsGrep Finds whether the array has that specified element(s) or not.
jsHas Returns all elements that matches in the selected element.
jsHasClass Checks whether the selected element has the specified class or not.
jsHeightGet Returns height of the first element in the set of matched elements.
jsHeightSet Sets the height of every selected matched elements.
jsHover Similar to that hover as of CSS.
jsIf If Condition
jsIfElse If Else Condition
jsIFrameReload Trigger a reload of an iFrame.
jsIncludes Returns true if an array has specified value or else false.
jsIndexOf Returns the first index at which the selected element matches in the array or -1 if it is not present.
jsInnerHtml Get the HTML content of the first matched element in the selected element's set of matched elements.
jsInsertAfter Insert HTML elements after each matched selected elements.
jsInsertBefore Insert HTML elements before each matched selected elements.
jsIsEmpty Checks whether the selected element has children element(s) or not and returns a boolean value.
jsIsPlainObj Checks whether the selected element has a plain object or not and returns a boolean value.
jsJSONParse It converts text into a JavaScript object
jsJSONStringify It converts a JavaScript object into a string.
jsKeyDown Triggers the keydown event, or attaches a function to run when a keydown event occurs.
jsKeyPress Triggers the keypress event, or attaches a function to run when a keypress event occurs.
jsKeyUp Triggers the keyup event, or attaches a function to run when a keyup event occurs.
jsLast Returns the last element of the selected element.
jsLastIndexOf Returns the last index at which the selected element matches in the array, or -1 if it is not present.
jsLength Returns length of the selected element.
jsLoad Load data from the server and place the returned HTML at the matched selected element.
jsLoadAfterPageLoaded Javascript gets loaded only after the entire page has been loaded.
jsLowerCase Changes the selected element value to Lower Case.
jsMakeArray Takes an object as an input and transforms it into an array.
jsMap Creates a new array using the old array values.
jsMouseDown Event occurs when the left mouse button is pressed down over the selected element.
jsMouseEnter Event occurs when the mouse pointer is over (enters) the selected element.
jsMouseLeave Event occurs when the mouse pointer leaves the selected element.
jsMouseMove Event occurs when the mouse pointer moves within the selected element.
jsMouseUp Event occurs when the left mouse button is released over the selected element.
jsMouseWheelScroll Prevents the page from scrolling down for 30 seconds.
jsNext Returns only first next sibling element of the selected element.
jsNextAll Returns all next sibling elements of the selected element.
jsNextUntil Returns all next sibling elements between the starting and ending element.
jsNoConflict If two different frameworks are using the same shortcut and if we want to use $ sign in both of them, then we can use this and prevent them from getting stopped working.
jsNot Returns the elements that contadicts the passed values of the selected element.
jsNumIsFinite It determines whether the passed value is a finite number or not.
jsNumIsInteger It determines whether the passed value is an integer or not.
jsNumIsNaN It determines whether the passed value is NaN and its type is Number or not.
jsNumIsSafeInteger It determines whether the provided value is a number that is a safe integer.
jsNumParseFloat It parses a string argument and returns a floating point number.
jsNumToExponential It returns a string representing the Number object in exponential notation.
jsNumToPrecision It formats a number using fixed-point notation.
jsOff Removes the event handlers for the selected element.
jsOffset Returns coordinates of the selected element wrt the document.
jsOffsetParent Returns first parent element of the selected element.
jsOnchangeFunction Triggers the change event whenever the value of the selected element changes.
jsOne Call one or more function for the selected element.
jsOuterHeight Returns the outer height of the first matched element.
jsOuterHtml Get the first element in the set of matched elements of the selected element's outer HTML contents.
jsOuterWidth Returns the outer width of the first matched element.
jsParent Return the direct parent element of the selected element.
jsParents Return all ancestor elements of the selected element.
jsParentsUntil Returns all ancestor elements between selected elements.
jsPosition Get the position of the selected element in the set of matched elements with respect to its parent element.
jsPost Load data from the server using a HTTP POST request.
jsPrepend Inserts your desired content for the specific value at the beginning of each element wherever it matches with the selected element.
jsPrependTo Insert your desired content at the beginning of each element wherever it matches with the selected element.
jsPrev Returns previous sibling element of the selected element.
jsPrevAll Returns all previous sibling elements of the selected element.
jsPrevRightClick Right Click can be disabled in your whole document.
jsPromise Promise Statement
jsPromiseAll Takes multiple iterable promises and returns a single promise.
jsPromiseCatch Returns a Promise and delas with rejected ones.
jsPromiseReject Returns a Promise that is rejected due to some specific reason.
jsPromiseResolve Returns a Promise that is resolved with the specific value.
jsPromiseThen Promise Then takes two arguments a callback for success and another for failure.
jsProp Sets property for the selected element.
jsProxy Takes value from an existing function and returns new one with particular context of the selected element.
jsQueue Keeps the functions in queue that are waiting to get executed.
jsRefreshPage Refreshes the Current Web Page.
jsRemoveAttr Remove attribute value wherever it matches with the selected element.
jsRemoveClass Removes the specified class/classes wherever it matches with the selected element.
jsRemoveData Remove data attribute value wherever it matches with the selected element set by using data-* attribute.
jsRemoveProp Removes property set by using the jsProp.
jsReplace Replace your old string with the your desired content wherever it matches with the selected element.
jsReplaceAll Replace your desired content wherever it matches with the selected element.
jsReplaceWith Replace each specified value in the set wherever it matches with the selected element with the content that you want to replace with and appends the replaced value with the selected element that was removed.
jsReset Resets form for the selected form Id.
jsResize Event fired when browser's window size changes.
jsScroll Triggers the scroll event on the selected element.
jsScrollLeft Returns horizontal scrollbar position of the selected element.
jsScrollTop Returns vertical scrollbar position of the selected element.
jsSerialize Get your whole form data in string format.
jsSerializeArray Get your whole form data in arrays format.
jsSetAttr Set attribute value wherever it matches with the selected element.
jsSetCheckboxRadioValId Set Checkbox/Radio Value by using Id.
jsSetCheckboxRadioValName Set Checkbox/Radio Value by using Name.
jsSetData Set data attribute value wherever it matches with the selected element set by using data-* attribute.
jsSetDefaultDate Set default date in Jquery UI Datepicker.
jsSetHref Set Href.
jsSetImmediate Breaks long operations and callabcks the function immediately.
jsSetInputValue Set Selected Input Value.
jsSetInterval Executes a function at specific Intervals.
jsSetOptionValue Set Selected Option Value.
jsSetPropChecked Set Checkbox/Radio Value to be true.
jsSetTimeout Executes a function at specific milliseconds and would be executed only once and won't be repeated.
jsSiblings Returns all sibling elements of the selected element.Also multiple filters can be applied to it.
jsSlice Returns the subset of elements based on its index.
jsSlideDown Slides-down the selected elements.
jsSlideDownFull Slides-down the selected elements after specified time interval.
jsSlideToggle Toggles between jsSlideUp and jsSlideDown.
jsSlideToggleFull Toggles between jsSlideUp and jsSlideDown after specified time interval.
jsSlideUp Slides-up the selected elements.
jsSlideUpFull Slides-up the selected elements after specified time interval.
jsStop Stop an event or function abruptly before its execution completes.
jsStopLoad When you don’t want links to go to a certain page or even reload it, we want them to do something else like trigger some other script and in that case this piece of code will do the trick of preventing the default action.
jsStrCharCodeAt Returns the Unicode of the character at the specified index in a string.
jsStrCodePointAt Returns the Unicode value of the character at the specified index in a string.
jsStrEndsWith It checks whether a string ends with the characters of a specified string and returns true/false.
jsStrLength Get length of the selected element.
jsStrMatch Returns the result of matching a string against for the specified regular expression.
jsStrMatchAll Returns an iterator of all results matching a string against a regular expression.
jsStrNormalize Removes empty Text nodes, and joins adjacent Text nodes.
jsStrPadEnd Adds padding from the end of the selected string.
jsStrPadStart Adds padding from the start of the selected string.
jsStrRepeat Returns a new string which contains the concatenated string.
jsStrReplace Returns a new string with replaced text.
jsStrSearch It searches for a match between a regular expression and the string.
jsStrSplit Splits a string object into an array of strings by separating the string into substrings, using a specified separator string to determine where to make each split.
jsStrStartsWith Determines whether a string begins with the characters of a specified string and returns true/false.
jsStrSubstring Returns the part of the string between the start and end indexes, or to the end of the string.
jsStrToArr Split the selected element string to an array.
jsStrTrimEnd It removes whitespace from the end of a string.
jsStrTrimStart It removes whitespace from the beginning of a string.
jsSubmit Submits form for the selected form Id.
jsSwitch Switch Case to select one of many code blocks to be executed.
jsTextboxDisable Set textbox to be disabled.
jsToggleClass Modifies CSS classes on HTML elements for the selected element.
jsToStr Converts a number to string.
jsTrim Removes white-spaces from each end of the string of the selected element.
jsTryCatch Try statement allows you to define a block of code to be tested for errors while it is being executed.
jsTryCatchFinally Catch statement allows you to define a block of code to be executed, if an error occurs in the try block.
jsTryFinally Finally statement lets you execute code, after try and catch, regardless of the result.
jsUnload Unload an event.
jsUnwrap Removes parent element of the selected element.
jsUpperCase Changes the selected element value to Upper Case.
jsValueOf Returns the value of a string.
jsWrap Wraps an HTML element individually in the set of matched elements.
jsWrapAll Wraps an HTML element within a group in the set of matched elements.

License

MIT License

Copyright (c) 2022 patelabhi23

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft