सभी tools
निःशुल्क

खोजने और प्रिंट करने योग्य jQuery संदर्भ — सेलेक्टर, DOM हेरफेर, इवेंट, इफेक्ट, ट्रैवर्सिंग, AJAX और फ़ॉर्म हेल्पर। निःशुल्क।

Selectors

14
$('#id')
Select an element by its id
$('.class')
Select all elements with a class
$('div')
Select all elements of a tag name
$('*')
Select every element in the page
$('[name="email"]')
Select by an attribute value
$('a[href^="https"]')
Attribute starts-with selector
$('ul li:first')
First matched element
$('ul li:last')
Last matched element
$('tr:eq(2)')
Element at a zero-based index
$('li:not(.done)')
Exclude elements matching a selector
$(':checked')
All checked checkboxes/radios
$('div:visible')
Only currently visible elements
$('ul li')
Descendant combinator
$('ul > li')
Direct child combinator

Document ready & DOM

10
$(function () { /* ... */ });
Run code once the DOM is ready
$(document).ready(fn)
Explicit document-ready handler
$(window).on('load', fn)
Run after all assets have loaded
$(this)
Wrap the current context element
$(el)
Wrap a raw DOM node in jQuery
$('<div class="box"></div>')
Create a new element from HTML
$('#box')[0]
Get the underlying DOM node
$('#box').get(0)
Get the DOM node via .get()
$('.item').length
Count the matched elements
$('#box').is(':visible')
Test a selector against the set

DOM manipulation

12
$('#box').html('<b>Hi</b>')
Set the inner HTML
$('#box').text('Hello')
Set the text content (escaped)
$('#name').val('Ada')
Set a form field value
$('#list').append('<li>x</li>')
Insert content at the end
$('#list').prepend('<li>x</li>')
Insert content at the start
$('#box').before('<hr>')
Insert content before the element
$('#box').after('<hr>')
Insert content after the element
$('#box').remove()
Remove the element from the DOM
$('#box').empty()
Remove all child nodes
$('#box').clone()
Create a copy of the element
$('#box').wrap('<div>')
Wrap the element in new HTML
$('#box').replaceWith('<p>')
Replace the element entirely

Attributes & CSS

13
$('#img').attr('src')
Get an attribute value
$('#img').attr('alt', 'Logo')
Set an attribute value
$('#cb').prop('checked')
Get a DOM property (checked/disabled)
$('#cb').prop('checked', true)
Set a DOM property
$('#img').removeAttr('title')
Remove an attribute
$('.box').addClass('active')
Add a CSS class
$('.box').removeClass('active')
Remove a CSS class
$('.box').toggleClass('open')
Toggle a CSS class on/off
$('.box').hasClass('active')
Test if a class is present
$('#box').css('color', 'red')
Set a single CSS property
$('#box').css({top: 0, left: 0})
Set multiple CSS properties
$('#box').width()
Get the computed width in pixels
$('#box').height()
Get the computed height in pixels

Events

12
$('#btn').on('click', fn)
Attach an event handler
$('#btn').off('click')
Detach event handlers
$('#btn').click(fn)
Shorthand click handler
$('#form').submit(fn)
Handle form submission
$('#sel').change(fn)
Handle value changes
$('#in').keyup(fn)
Handle key-up in a field
$('#list').on('click', '.item', fn)
Delegated event for dynamic children
$('#btn').trigger('click')
Programmatically fire an event
$('#btn').one('click', fn)
Run a handler at most once
e.preventDefault()
Stop the default browser action
e.stopPropagation()
Stop the event from bubbling
e.target
The element that triggered the event

Effects & animation

12
$('#box').show()
Display a hidden element
$('#box').hide()
Hide an element
$('#box').toggle()
Toggle visibility
$('#box').fadeIn(300)
Fade an element in
$('#box').fadeOut(300)
Fade an element out
$('#box').fadeTo(300, 0.5)
Fade to a given opacity
$('#box').slideUp()
Slide an element up (collapse)
$('#box').slideDown()
Slide an element down (expand)
$('#box').slideToggle()
Toggle a slide animation
$('#box').animate({left: 100})
Animate CSS properties
$('#box').stop()
Stop the current animation
$('#box').delay(500).fadeIn()
Delay the next queued effect

Traversing

12
$('#box').find('.item')
Find descendants matching a selector
$('#box').parent()
Get the direct parent
$('#box').parents('.row')
Get all ancestors matching a selector
$('#box').closest('.row')
Nearest matching ancestor (or self)
$('#box').children()
Get the direct children
$('#box').siblings()
Get sibling elements
$('#box').next()
Get the next sibling
$('#box').prev()
Get the previous sibling
$('.item').each(fn)
Iterate over each matched element
$('.item').filter('.on')
Reduce the set by a selector
$('.item').first()
Reduce the set to the first element
$('.item').eq(1)
Reduce the set to one index

AJAX

11
$.ajax({url: '/api', method: 'GET'})
Full-control AJAX request
$.get('/api', fn)
Shorthand HTTP GET request
$.post('/api', data, fn)
Shorthand HTTP POST request
$.getJSON('/api.json', fn)
GET request expecting JSON
$('#box').load('/part.html')
Load HTML into an element
$.ajax({dataType: 'json'})
Set the expected response type
$.ajax({data: {q: 'x'}})
Send request parameters
.done(function (res) {})
Run a callback on success
.fail(function (err) {})
Run a callback on failure
.always(function () {})
Run a callback after completion
$.ajaxSetup({headers: {}})
Set defaults for all requests

Forms

10
$('#form').serialize()
Encode form data as a query string
$('#form').serializeArray()
Encode form data as an array
$('#name').val()
Read a field value
$('#name').val('Ada')
Write a field value
$(':input')
Select all form input elements
$('#cb').is(':checked')
Test if a checkbox is checked
$('#sel option:selected')
Get the selected option
$('#in').focus()
Move focus to a field
$('#form').on('submit', fn)
Handle the form submit event
$('#in').prop('disabled', true)
Disable a form control

Utilities

11
$.each(arr, fn)
Iterate over an array or object
$.map(arr, fn)
Build a new array from each item
$.grep(arr, fn)
Filter an array by a predicate
$.extend({}, a, b)
Merge objects into a target
$.trim(' hi ')
Trim leading/trailing whitespace
$.inArray(2, arr)
Find an item index in an array
$.isArray(x)
Test whether a value is an array
$.isFunction(x)
Test whether a value is a function
$.parseJSON(str)
Parse a JSON string into an object
$.now()
Current timestamp in milliseconds
$.type(x)
Get the internal type of a value

कोई प्रविष्टि “:q” से मेल नहीं खाती।


jQuery चीट शीट के बारे में

यह jQuery चीट शीट उस लाइब्रेरी का एक संक्षिप्त रेफरेंस है जो अब भी मौजूदा साइट्स के एक बड़े हिस्से को पावर देती है: सिलेक्टर, डॉक्यूमेंट रेडी और DOM बेसिक्स, DOM मैनिपुलेशन, एट्रिब्यूट और CSS, इवेंट्स, इफेक्ट्स और एनिमेशन, ट्रैवर्सिंग, AJAX, फॉर्म, और यूटिलिटीज़।

अगर आप लीगेसी फ्रंट-एंड, प्लगइन या पुरानी CMS थीम मेंटेन करते हैं, तो jQuery की समझ आज भी एक व्यावहारिक स्किल है। हर रो एक मेथड कॉल को एक-पंक्ति विवरण के साथ जोड़ती है, ताकि आप इवेंट डेलिगेशन, चेन्ड ट्रैवर्सल या AJAX रिक्वेस्ट का सटीक सिग्नेचर पुरानी डॉक्यूमेंटेशन खंगाले बिना याद कर सकें।

यह शीट फ्री है और पूरी तरह क्लाइंट-साइड है। सर्च बॉक्स से मेथड्स को लाइव फिल्टर करें, स्टिकी टेबल ऑफ कंटेंट्स से सेक्शनों के बीच जंप करें, किसी भी स्निपेट को एक क्लिक से कॉपी करें और जब आप लीगेसी रीफैक्टर में गहरे हों तब पेज प्रिंट करें।

jQuery चीट शीट का उपयोग कैसे करें

  1. सेक्शन देखें, Selectors और Document ready & DOM से लेकर Traversing होते हुए AJAX और Utilities तक।
  2. on, closest या ajax जैसा कोई मेथड सर्च करें ताकि शीट लाइव फिल्टर हो जाए।
  3. स्टिकी साइडबार के जरिए Effects & animation जैसे सेक्शन पर जंप करें।
  4. jQuery कॉल को अपने कोड में कॉपी करने के लिए किसी स्निपेट या उसके कॉपी आइकन पर क्लिक करें।
  5. लीगेसी प्रोजेक्ट्स पर काम करते समय ऑफलाइन रेफरेंस के लिए शीट प्रिंट करें।

अक्सर पूछे जाने वाले प्रश्न

दस सेक्शन: सिलेक्टर, डॉक्यूमेंट रेडी और DOM बेसिक्स, DOM मैनिपुलेशन, एट्रिब्यूट और CSS, इवेंट्स, इफेक्ट्स और एनिमेशन, ट्रैवर्सिंग, AJAX, फॉर्म, और यूटिलिटी हेल्पर।

नए प्रोजेक्ट्स के लिए ज्यादातर टीमें वैनिला JavaScript इस्तेमाल करती हैं, लेकिन प्रोडक्शन कोड, प्लगइन और CMS थीम की बहुत बड़ी मात्रा अब भी jQuery पर चलती है — यह शीट उस कोड को आत्मविश्वास से मेंटेन और माइग्रेट करने के लिए बनाई गई है।

हां। इवेंट्स सेक्शन में .on() का डेलिगेटेड फॉर्म बाइंडिंग, अनबाइंडिंग और ट्रिगरिंग के साथ शामिल है — वह पैटर्न जो आपको डायनामिक रूप से डाले गए एलिमेंट्स के साथ काम करते समय सबसे ज्यादा चाहिए।

हां। किसी भी स्निपेट या उसकी रो पर मौजूद कॉपी आइकन पर क्लिक करें और कॉल पेस्ट करने के लिए तैयार आपके क्लिपबोर्ड में कॉपी हो जाती है।

हां, पूरी तरह मुफ्त — बिना साइन-अप के आपके ब्राउज़र में सर्च करने योग्य, प्रिंट करने योग्य और रेंडर होने वाला।

इसे साझा करें

लोकप्रिय खोजें
jquery cheat sheet jquery selectors jquery ajax syntax jquery event methods jquery dom manipulation jquery effects and animation jquery traversing methods jquery reference
मदद चाहिए?
इस टूल में कोई समस्या मिली? हमारी टीम को बताएं।
समस्या की रिपोर्ट करें

इस मुफ़्त टूल को अपनी वेबसाइट पर जोड़ें — नीचे दिया गया कोड कॉपी और पेस्ट करें।