I need to assign a custom property to a jQuery object. Here is the object:
var object = $("<div id='item'></div>");
I need object
to have a custom data member. How can I add this?
Set a Single CSS Property and Value The css() method can take a property name and value as separate parameters for setting a single CSS property for the elements. The basic syntax can be given with: $(selector). css("propertyName", "value");
The prop() method sets or returns properties and values of the selected elements. When this method is used to return the property value, it returns the value of the FIRST matched element. When this method is used to set property values, it sets one or more property/value pairs for the set of matched elements.
.data()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With