[ jQuery ] attr() v.s. prop()

prop()

is DOM node properties i.e. selectedIndex, tagName, nodeName, nodeType, ownerDocument, defaultChecked, and defaultSelected

attr()

is attribute in HTML

 

Example 

.attr( “checked” ): checked
.prop( “checked” ): true

 

 

ref : https://stackoverflow.com/questions/16051491/difference-between-prop-and-attr-in-jquery-and-when-to-use-attr-and-prop,

http://api.jquery.com/prop/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s