Skip to content
Permalink
Browse files

Fixed .val(String) for select elements (#1760) [Thanks Sam]

  • Loading branch information
brandonaaron committed Oct 12, 2007
1 parent 0f5c1d1 commit 971840f343dae04fdc6ff51ecb03ec8b3aaee067
Showing with 5 additions and 2 deletions.
  1. +1 −1 src/core.js
  2. +4 −1 test/unit/core.js
@@ -407,7 +407,7 @@ jQuery.fn = jQuery.prototype = {
jQuery.inArray( this.text, values ) >= 0);
});

if ( !tmp.length )
if ( !values.length )
this.selectedIndex = -1;

} else
@@ -824,11 +824,14 @@ test("val()", function() {
});

test("val(String)", function() {
expect(2);
expect(3);
document.getElementById('text1').value = "bla";
ok( $("#text1").val() == "bla", "Check for modified value of input element" );
$("#text1").val('test');
ok ( document.getElementById('text1').value == "test", "Check for modified (via val(String)) value of input element" );

$("#select1").val("3");
ok( $("#select1").val() == "3", "Check for modified (via val(String)) value of select element" );
});

test("html(String)", function() {

0 comments on commit 971840f

Please sign in to comment.
You can’t perform that action at this time.