Created by: J2TEAM
Quotes from jQuery API Docs:
To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method.
As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes.
For example,
selectedIndex
,tagName
,nodeName
,nodeType
,ownerDocument
,defaultChecked
, anddefaultSelected
should be retrieved and set with the.prop()
method. Prior to jQuery 1.6, these properties were retrievable with the.attr()
method, but this was not within the scope of attr. These do not have corresponding attributes and are only properties.
So, I think the .attr()
method will be better to get the type attribute from the input :D