Reputation: 141
Normal HTML dropdown menu:
<select name="email" id="email">
<option value="2" selected="selected">Before redirecting to PayPal</option>
<option value="1">After payment is successful</option>
<option value="3">Never send email</option>
</select>
Using jQuery this.defaultValue
returns 'undefined'.
Using $(this).val()
returns '2', correctly.
Why is this.defaultValue
returning 'undefined'?
Upvotes: 0
Views: 225
Reputation: 9157
As described on W3C, defaultValue
works only with certain types of the elements
defaultValue
of type DOMString
When thetype
attribute of the element has the value"text"
,"file"
or"password"
(...)
Upvotes: 4