diff --git a/src/attributes/val.js b/src/attributes/val.js
index 8454e80d0..16296a631 100644
--- a/src/attributes/val.js
+++ b/src/attributes/val.js
@@ -71,11 +71,10 @@ jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
- // Use proper attribute retrieval(#6932, #12072)
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
- elem.text;
+ jQuery.text( elem );
}
},
select: {
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 8ba2b4459..2b2eee425 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -1448,3 +1448,12 @@ test( "coords returns correct values in IE6/IE7, see #10828", function() {
area = map.html("").find("area");
equal( area.attr("coords"), "0,0,0,0", "did not retrieve coords correctly" );
});
+
+test( "should not throw at $(option).val() (#14686)", 1, function() {
+ try {
+ jQuery( "" ).val();
+ ok( true );
+ } catch ( _ ) {
+ ok( false );
+ }
+});