jQuery .removeProp() Method

Beginner
6 min read
Updated: Oct 2026
5 examples
Live preview

What Is .removeProp()?

.removeProp() (since 1.6) removes a property that was set with .prop() on every matched element. It is for custom properties — not HTML attributes and not native form state.

Remember
// Custom property — OK
$("p").prop("luggageCode", 1234);
$("p").removeProp("luggageCode");

// Native form state — do NOT removeProp
// $("input").removeProp("checked");  // avoid
$("input").prop("checked", false);    // correct

// App data — prefer .data()
$("#box").data("score", 10);
NeedUse
Remove custom property.removeProp(name)
Set / reset native property.prop(name, value)
Remove HTML attribute.removeAttr()
Store app values.data()
Form field text.val()

How to Use .removeProp()

Set a custom property with .prop(), then remove it when you no longer need it.

  1. Attach a custom property: .prop("myKey", value).
  2. Read it later with .prop("myKey") if needed.
  3. Clean up with .removeProp("myKey").
  4. For natives (checked, disabled), use .prop(name, false) — never .removeProp().
  5. For most app data, prefer .data() over custom .prop() keys.
PieceRequired?Role
propertyNameYesName of the custom property to remove
Return—Same jQuery object (chainable)
Scope—Every matched element
After removal—.prop(name) → undefined

Pseudocode

Pseudocode
call .removeProp(propertyName)

for each matched element:
    delete the JavaScript property named propertyName

return the jQuery collection

// For native form state instead:
//   .prop("checked", false)
//   .prop("disabled", false)

Cheat Sheet

Keep these facts handy when cleaning up custom properties.

TopicDetail
SincejQuery 1.6
PurposeRemove properties set via .prop()
Safe onCustom keys (e.g. luggageCode)
Unsafe onchecked, disabled, selected, …
Native reset.prop(name, false)
vs .removeAttr()Property layer vs HTML attribute layer
App dataPrefer .data()
Old IE noteNon-primitive .prop() values needed cleanup

Live Preview

Set and remove a custom luggageCode on the sample paragraph.

Sample element: the paragraph below. Custom property only — not a native form property.

Sample paragraph

Result
Ready — pick an action and click Run.

jQuery Examples

Short, copy-ready snippets. Use .removeProp() only on custom properties.

Example 1 — Official luggageCode Demo

Set a numeric custom property, show it, then remove it.

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

  1. Set. .prop("luggageCode", 1234) adds a custom property.
  2. Read. Getter returns 1234.
  3. Remove. .removeProp() deletes that key.
  4. After. Getter returns undefined.

Example 2 — Custom Flag Cleanup

Attach a temporary flag, then clear it when done.

jQuery
$("#box").prop("isReady", true);
$("#box").removeProp("isReady");
$("#out").text("isReady → " + $("#box").prop("isReady"));
Try It Yourself

How It Works

  1. Flag. Store a custom boolean with .prop().
  2. Done. Call .removeProp("isReady").
  3. Gone. The property no longer exists on the node.
  4. Note. For most flags, .data() is still clearer.

Example 3 — .removeProp() vs .removeAttr()

Properties and attributes are different layers — removing one does not remove the other.

jQuery
var $el = $("#item");
$el.attr("title", "Tip");
$el.prop("code", 7);

$el.removeProp("code");

$("#out").text(
  "prop code=" + $el.prop("code") +
  ", attr title=" + $el.attr("title")
);
Try It Yourself

How It Works

  1. Attr. title lives in HTML markup.
  2. Prop. code is a custom JS property.
  3. removeProp. Deletes only code.
  4. title. Still present until .removeAttr().

Example 4 — Reset Native State with .prop(false)

Do not .removeProp("checked") — set the property to false.

jQuery
$("input").prop("checked", true);
$("input").prop("checked", false);

$("#out").text(
  "checked → " + $("input").prop("checked")
);
Try It Yourself

How It Works

  1. Check. Set live state with .prop("checked", true).
  2. Uncheck. Set false — keep the property intact.
  3. Avoid. .removeProp("checked") can break expected behavior.
  4. Same rule. Apply to disabled and selected.

Example 5 — Prefer .data() for App Values

Store temporary values with .data() instead of inventing custom properties.

jQuery
$("#box").data("score", 10);
$("#out").text("score → " + $("#box").data("score"));

$("#box").removeData("score");
$("#out").append(" | after removeData → " + $("#box").data("score"));
Try It Yourself

How It Works

  1. Store. .data() keeps values in jQuery’s cache.
  2. Read. Getter returns the stored value.
  3. Clear. .removeData() drops the key safely.
  4. Why. Safer than custom .prop() for app metadata.

Edge Cases & Pitfalls

These mistakes cause the most confusion with .removeProp().

native

Never .removeProp("checked")

Same for disabled and selected. Reset with .prop(name, false).

layer

Not a substitute for .removeAttr()

Attributes and properties are different. Removing a property does not remove the HTML attribute.

data

Prefer .data() for app state

jQuery recommends .data() for arbitrary values instead of custom DOM properties.

IE

Old IE + non-primitive .prop()

IE < 9 could leak if object/function props were not cleared before removing the element. Prefer .data() today.

Browser Support

.removeProp() has been part of jQuery since 1.6. Works wherever your loaded jQuery build runs. Prefer current jQuery 3.x+ and .data() for app values.

✓ Stable · jQuery 1.6+

jQuery .removeProp()

Universal across browsers that run your jQuery version. Use only for custom properties — never native form properties.

100% jQuery core
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 cleaning custom .prop() keys. For checked/disabled, always use .prop(name, false).

Performance Notes

ApproachCostBest for
One .removeProp()CheapCleaning a custom key
.data() / .removeData()CheapMost application state
Many custom props on many nodesMessyPrefer a single .data() object

Removal itself is cheap. The bigger cost is confusion — keep custom property use rare and prefer .data() for app metadata.

Key Takeaways

  • Role: remove custom properties set with .prop().
  • Never: call it on checked, disabled, or selected.
  • Natives: reset with .prop(name, false).
  • Prefer: .data() for most application values.

One line: .removeProp() cleans custom .prop() keys — never native form properties.

Frequently Asked Questions

.removeProp() removes a property previously set with .prop() on every matched element. Use it for custom properties you added — not for HTML attributes or native form state. Available since jQuery 1.6.
.removeProp() deletes a JavaScript property on the DOM node. .removeAttr() removes an HTML attribute from markup via removeAttribute(). They operate on different layers.
No. Official docs warn that removing native properties can cause unexpected behavior. Reset them with .prop("checked", false) or .prop("disabled", false) instead.
To clean up custom properties you attached with .prop() — for example a temporary flag or code like luggageCode. Prefer .data() for most application values.
Yes. It removes the named property from every element in the collection and returns the jQuery object for chaining.
In IE before version 9, assigning non-primitive values via .prop() could leak memory unless .removeProp() cleared them before the element left the document. Modern code should prefer .data() for arbitrary values.

Next: jQuery DOM

Continue with DOM methods — including .data() for safer app state.

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.

11 people found this page helpful