jQuery .removeProp() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Attributes

Definition

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

Syntax

Start with these common calls. Keep them short and readable.

jQuery
// 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);
CallWhat it does
.removeProp()Learn jQuery .removeProp(): remove custom properties set with .prop(), never use it on native checked/disabled/selected, prefer .prop(name, false) for form state, and use .data() for app values.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Attach a custom property: .prop("myKey", value).
Step 2Read it later with .prop("myKey") if needed.
Step 3Clean up with .removeProp("myKey").

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.

jQuery Examples

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.

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.

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.

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: CSS Methods

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

CSS Methods tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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