jQuery .removeProp() Method

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Attribute methods

What You’ll Learn

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

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.

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").

📝 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:

jQuery
// Correct — reset native boolean state
$( "input" ).prop( "checked", false );
$( "button" ).prop( "disabled", false );



// Avoid — unexpected behavior
// $( "input" ).removeProp( "checked" );
// $( "button" ).removeProp( "disabled" );

Official jQuery API example

jQuery
var para = $( "p" );
para
  .prop( "luggageCode", 1234 )
  .append( "The secret luggage code is: ", String( para.prop( "luggageCode" ) ), ". " )
  .removeProp( "luggageCode" )
  .append( "Now the secret luggage code is: ", String( para.prop( "luggageCode" ) ), ". " );

⚡ Quick Reference

GoalCode
Remove custom property$("p").removeProp("luggageCode")
Set custom property first$("div").prop("widgetState", { ready: true })
Read after removal$("p").prop("luggageCode")undefined
Uncheck checkbox (native)$("input").prop("checked", false) — not .removeProp()
Remove HTML attribute$("img").removeAttr("title") — use .removeAttr()
Store arbitrary JS data$("div").data("key", value) — prefer over .prop() for objects

📋 .removeProp() vs .removeAttr() vs .prop(false) vs .data()

Four ways to clear information from elements — pick the right layer.

.removeProp()
- jQ prop

Remove custom properties set via .prop()

.removeAttr()
- HTML attr

Remove markup attributes — title, alt, data-* in HTML

.prop(false)
reset native

Reset checked, disabled, selected — do not remove them

.data()
JS storage

Preferred for arbitrary values — avoids legacy IE leaks

Examples Gallery

Examples 1–5 follow the official jQuery API documentation and practical patterns. Use DevTools or the Try-it links to run each snippet in the browser.

📚 Getting Started

Official jQuery demo for setting and removing a custom numeric property.

Example 1 — Official Demo: luggageCode Property

Set a numeric property on a paragraph, display it, then remove it — the second read returns undefined.

jQuery
var para = $( "p" );
para
  .prop( "luggageCode", 1234 )
  .append( "The secret luggage code is: ", String( para.prop( "luggageCode" ) ), ". " )
  .removeProp( "luggageCode" )
  .append( "Now the secret luggage code is: ", String( para.prop( "luggageCode" ) ), ". " );
Try It Yourself

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.

jQuery
var $panel = $( "#panel" );
$panel.prop( "widgetVersion", 2 );
// ... widget runs ...
$panel.removeProp( "widgetVersion" ).removeClass( "is-active" );
$( "#log" ).text( "widgetVersion: " + $panel.prop( "widgetVersion" ) );
Try It Yourself

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.

jQuery
$( "#agree" ).prop( "checked", false );
$( "#log" ).html(
  "checked via .prop(): " + $( "#agree" ).prop( "checked" ) + "<br>" +
  "Use .prop('checked', false) — not .removeProp('checked')"
);
Try It Yourself

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.

jQuery
var $el = $( "#temp" );
$el.prop( "tempRef", { id: 99 } );
$el.removeProp( "tempRef" );
$el.remove();
$( "#log" ).text( "Removed element; tempRef cleared first" );
Try It Yourself

How It Works

Assigning objects via .prop() on DOM nodes is discouraged today. If legacy code did so, call .removeProp() before .remove() to avoid IE memory leaks.

Example 5 — .removeProp() vs .removeAttr() on the Same Element

A title HTML attribute and a custom badgeCount property live on different layers — remove each with the matching API.

jQuery
var $box = $( "#box" );
$box.prop( "badgeCount", 5 );
$box.removeAttr( "title" ).removeProp( "badgeCount" );
$( "#log" ).html(
  "attr title: " + $box.attr( "title" ) + "<br>" +
  "prop badgeCount: " + $box.prop( "badgeCount" )
);
Try It Yourself

How It Works

.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.

🚀 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.

📝 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().

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 Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
.removeProp() Universal

Bottom line: Safe for custom properties. Never remove native checked/disabled/selected — set them to false instead.

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").

💡 Best Practices

✅ Do

  • Use .removeProp() to undo custom .prop() assignments
  • Reset native booleans with .prop("checked", false)
  • Store arbitrary JS data with .data() instead of .prop()
  • Clean up custom properties before destroying widgets or detaching nodes
  • Pair with .removeAttr() when clearing both layers

❌ Don’t

  • 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)

Key Takeaways

Knowledge Unlocked

Five things to remember about .removeProp()

Undo custom .prop() — never strip native state.

5
Core concepts
custom 02

Custom only

Not native props

Scope
all 03

Every match

All elements

Behavior
false 04

Native reset

.prop(false)

Pattern
.data 05

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.

Next: jQuery DOM

Remove elements from the document while preserving event handlers with .detach().

DOM hub →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful