The snippet library.
Small, practical examples. Search by task or narrow things down below.
Read a text field’s value
jQuery: Learn how to read a text field’s value in a complete browser example.
jQuery✓ Tested
Read an element’s document coordinates
jQuery: offset returns coordinates relative to the document.
jQuery✓ Tested
Read an element’s text
jQuery: Learn how to read an element’s text in a complete browser example.
jQuery✓ Tested
Read checked options
Collect checked checkbox values with jQuery map and get.
jQuery✓ Tested
Refresh a cached data attribute deliberately
jQuery: After the first read, data caches a parsed value; removeData forces a new attribute read.
jQuery✓ Tested
Reject a deferred result
jQuery: fail receives the reason supplied to reject.
jQuery✓ Tested
Remove a CSS class
jQuery: Learn how to remove a CSS class in a complete browser example.
jQuery✓ Tested
Remove a wrapper while preserving its children
jQuery: unwrap replaces a selected element’s parent with that parent’s contents.
jQuery✓ Tested
Remove an optional attribute entirely
jQuery: removeAttr removes the attribute instead of setting a string that might still activate it.
jQuery✓ Tested
Remove matching elements
Remove selected list items from the DOM with jQuery.
jQuery✓ Tested
Remove one handler without removing others
jQuery: Pass the original function reference to off.
jQuery✓ Tested
Remove one selected element
jQuery: Learn how to remove one selected element in a complete browser example.
jQuery✓ Tested