Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (37 sloc) 1.94 KB
<?xml version="1.0"?>
<entry type="method" name="removeProp" return="jQuery">
<argument name="propertyName" type="String">
<desc>The name of the property to remove.</desc>
<desc>Remove a property for the set of matched elements.</desc>
<p>The <code>.removeProp()</code> method removes properties set by the <code><a href="">.prop()</a></code> method.</p>
<p>With some built-in properties of a DOM element or <code>window</code> object, browsers may generate an error if an attempt is made to remove the property. jQuery first assigns the value <code>undefined</code> to the property and ignores any error the browser generates. In general, it is only necessary to remove custom properties that have been set on an object, and not built-in (native) properties.</p>
<p><strong>Note:</strong> Do not use this method to remove native properties such as checked, disabled, or selected. This will remove the property completely and, once removed, cannot be added again to element. Use <code><a href="">.prop()</a></code> to set these properties to <code>false</code> instead.</p>
<note id="prop-memory-leaks" type="additional"/>
<desc>Set a numeric property on a paragraph and then remove it. </desc>
var $para = $("p");
$para.prop("luggageCode", 1234);
$para.append("The secret luggage code is: ", String($para.prop("luggageCode")), ". ");
$para.append("Now the secret luggage code is: ", String($para.prop("luggageCode")), ". ");
img { padding:10px; }
div { color:red; font-size:24px; }
<category slug="attributes"/>
<category slug="manipulation/general-attributes"/>
<category slug="version/1.6"/>
Something went wrong with that request. Please try again.