Side navigation
#1760 closed bug (fixed)
Opened October 01, 2007 09:59AM UTC
Closed October 12, 2007 12:52PM UTC
Last modified October 14, 2008 10:29AM UTC
[jquery svn rev 3463] setting a val for a select box - tmp is not defined
Reported by: | epsilon68 | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | core | Version: | 1.2.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
only with jquery svn rev 3463 (not with the release 1.2.1)
if you set the value for a select box, it shows the error: tmp is not defined
with this code:
<html> <head> <title>Untitled Page</title> <script src="../lib/jquery-svn.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> function tryToSelect() { alert($('#myselect').val()); $('#myselect').val('4'); } </script> </head> <body> <select id="myselect"> <option value="1">1er</option> <option value="2">2er</option> <option value="3">3er</option> <option value="4">4er</option> </select> <input type="button" value="select" onclick="tryToSelect();" /> </body> </html>
it shows: tmp is not defined!
} else 391 return this.each(function(){ 392 if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) 393 this.checked = (jQuery.inArray(this.value, value) >= 0 || 394 jQuery.inArray(this.name, value) >= 0); 395 396 else if ( jQuery.nodeName( this, "select" ) ) { 397 var values = value.constructor == Array ? 398 value : 399 [ value ]; 400 401 jQuery( "option", this ).each(function(){ 402 this.selected = (jQuery.inArray( this.value, values ) >= 0 || 403 jQuery.inArray( this.text, values ) >= 0); 404 }); 405 406 if ( !tmp.length ) <-- here 407 this.selectedIndex = -1; 408 409 } else 410 this.value = value; 411 });
Just change tmp to values