The .removeProp() method removes properties previously set with .prop() on matched elements. This tutorial covers the official luggageCode demo, comparisons with .removeAttr() and native property reset patterns, why you must not call it on checked or disabled, legacy IE memory-leak guidance, and five hands-on jQuery examples.
01
Custom props
jQuery-added only
02
All matches
Every element
03
vs .removeAttr()
Prop vs markup
04
Native props
Use .prop(false)
05
Cleanup
Before detach
06
Since 1.6
Core API
Fundamentals
Introduction
jQuery’s .prop() method can attach custom values to DOM elements — a numeric flag, plugin metadata, or a temporary reference. When that data is no longer needed, .removeProp() removes the property from every matched element.
Introduced in jQuery 1.6 alongside .prop(), this method is the mirror image of property assignment. It does not remove HTML attributes from markup — that is the job of .removeAttr(). It also should not be used to reset built-in browser properties such as checked, disabled, or selected.
The jQuery API documentation is explicit: it is almost always better to set native properties to false with .prop() than to remove them. Reserve .removeProp() for custom properties you added yourself.
Concept
Understanding the .removeProp() Method
Given a jQuery object representing one or more DOM elements, .removeProp(propertyName) deletes the named property from each element in the set. The method returns the original jQuery object for chaining — for example, $("p").removeProp("luggageCode").addClass("cleared").
After removal, reading the property with .prop(propertyName) returns undefined — the same as if the property had never been set. This differs from setting a native boolean property to false, which leaves the property present but falsy.
💡
Beginner Tip
Think of .removeProp() as undo for .prop() on custom keys. If you used .prop("checked", true), reset with .prop("checked", false) — not .removeProp("checked").
Foundation
📝 Syntax
jQuery .removeProp() accepts one argument:
Remove property — since 1.6
jQuery
.removeProp( propertyName )
propertyName — a string naming the property to remove.
Removes the property from every matched element.
Returns the original jQuery object (for chaining).
Return value
Always returns the original jQuery object — enabling method chaining.
WARNING: do not remove native properties
Built-in DOM properties behave unpredictably when removed. Reset them explicitly:
The secret luggage code is: 1234. Now the secret luggage code is: undefined.
How It Works
.prop("luggageCode", 1234) attaches a custom property. After .removeProp("luggageCode"), the getter returns undefined — jQuery stringifies it as "undefined" in the appended text.
Example 2 — Remove Plugin Metadata After Widget Destroy
Plugins often stash state with .prop(). Clean it up when tearing down the widget.
After destroy: widgetVersion: undefined
Panel loses is-active class; no leftover custom property
How It Works
Custom keys like widgetVersion are safe targets for .removeProp(). Chain .removeClass() in the same call to reset both DOM state and CSS in one fluent expression.
📈 Practical Patterns
Native property reset, pre-detach cleanup, and comparison with attribute removal.
Example 3 — Reset checked With .prop(false), Not .removeProp()
Unchecking a checkbox requires setting the native property to false — removing it causes unpredictable behavior.
Checkbox visually unchecked
checked via .prop(): false
.removeProp('checked') is documented as unsafe for native properties
How It Works
Native boolean properties remain on the element; you change their value. jQuery’s documentation warns that .removeProp("checked") leads to unexpected results across browsers.
Example 4 — Clear Custom Property Before Removing From DOM
On legacy IE, non-primitive .prop() values could leak unless removed before detach. Modern code should use .data(), but cleanup remains good practice.
.removeAttr("title") deletes the HTML attribute. .removeProp("badgeCount") deletes the custom property jQuery attached. Using the wrong method may leave data behind or fail silently.
Applications
🚀 Common Use Cases
Temporary flags — $("tr").removeProp("isDirty") after saving row edits.
Plugin teardown — $(".slider").removeProp("sliderInstance") when destroying a UI widget.
One-shot markers — $("form").removeProp("submitLock") after Ajax completes.
Legacy IE cleanup — $el.removeProp("cache") before $el.remove() when objects were stored via .prop().
Undo custom .prop() calls — mirror every .prop("customKey", value) with .removeProp("customKey") when done.
NOT for form state — use .prop("checked", false) and .prop("disabled", false) instead.
🧠 How .removeProp() Removes Properties
1
Match elements
jQuery object holds one or more DOM nodes.
Input
2
Read property name
Single string identifying the property to delete.
Args
3
Delete from each node
jQuery removes the property from every matched element.
DOM
4
⚙
jQuery object returned
.prop(name) now returns undefined — chain further methods freely.
Important
📝 Notes
Available since jQuery 1.6 — paired with the .prop() API.
Removes properties from every matched element; returns the jQuery object for chaining.
Removes only properties set via .prop() — not a substitute for .removeAttr().
Do not use on native properties: checked, disabled, selected, and others.
Reset native booleans with .prop(name, false) instead of removing them.
In IE < 9, non-primitive .prop() values could leak unless .removeProp() ran before DOM removal — prefer .data() today.
For arbitrary JavaScript storage, use jQuery .data() rather than attaching objects with .prop().
Compatibility
Browser Support
.removeProp() has been part of jQuery since 1.6+, introduced alongside .prop() to separate properties from attributes. It works in jQuery 1.x, 2.x, 3.x, and 4.x across all browsers supported by your jQuery build.
✓ jQuery 1.6+
jQuery .removeProp()
Supported wherever jQuery runs. The legacy IE memory-leak note applies only to IE before version 9 when storing non-primitive values via .prop() — modern projects should use .data() for objects and .removeProp() only for custom .prop() cleanup.
100%With jQuery loaded
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.removeProp()Universal
Bottom line: Safe for custom properties. Never remove native checked/disabled/selected — set them to false instead.
Wrap Up
Conclusion
The jQuery .removeProp() method removes custom properties previously set with .prop() from every matched element. It is the cleanup counterpart to property assignment — not a general-purpose “reset element” tool.
Remember the official demo: set luggageCode to 1234, read it, then .removeProp("luggageCode") so the next read is undefined. For HTML attributes use .removeAttr(); for native form state use .prop("checked", false). Chain freely — .removeProp("temp").removeClass("busy").
Call .removeProp("checked") or .removeProp("disabled")
Use .removeProp() to remove HTML attributes — use .removeAttr()
Attach complex objects with .prop() on DOM nodes in new code
Assume removing a property resets unrelated attributes or CSS classes
Confuse .removeProp() with clearing inline handlers — use .prop("onclick", null)
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about .removeProp()
Undo custom .prop() — never strip native state.
5
Core concepts
1.601
Since 1.6
Paired with .prop()
API
custom02
Custom only
Not native props
Scope
all03
Every match
All elements
Behavior
false04
Native reset
.prop(false)
Pattern
.data05
Use .data()
For objects
Modern
❓ Frequently Asked Questions
.removeProp() removes a property that was previously set with .prop() on matched elements. It is the dedicated cleanup API for jQuery-added custom properties — not for stripping HTML attributes or resetting native DOM state. Available since jQuery 1.6.
.removeProp() removes JavaScript properties on DOM nodes — typically custom values you attached with .prop('myKey', value). .removeAttr() removes HTML attributes from markup such as title, alt, and data-* via removeAttribute(). They operate on different layers of the element.
No. jQuery documentation warns against using .removeProp() on built-in native properties like checked, disabled, and selected — it can cause unexpected behavior. Reset form state with .prop('checked', false) or .prop('disabled', false) instead.
Use it to clean up custom properties you added with .prop() — for example a temporary luggageCode flag on a paragraph, plugin metadata on a widget, or non-primitive values on legacy IE before detaching the element from the document.
Yes. Like other jQuery setters, .removeProp() removes the named property from every element in the matched collection and returns the original jQuery object for chaining.
In Internet Explorer before version 9, assigning a non-primitive value (objects, functions) to a DOM property via .prop() could leak memory unless .removeProp() cleared it before the element was removed from the document. Modern code should prefer .data() for arbitrary JavaScript values instead of .prop().
Did you know?
jQuery 1.6 split attributes and properties into separate APIs because reading .attr("checked") returned the initial HTML string while .prop("checked") tracked live checkbox state. .removeProp() arrived in the same release as the cleanup hook for custom .prop() assignments — but the jQuery team deliberately warns against using it on native properties where setting false is the predictable, cross-browser approach.