Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#1760 closed bug (fixed)

[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 });

Attachments (1)

1760.diff (345 bytes) - added by Sam 12 years ago.

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by Sam

Attachment: 1760.diff added

comment:1 Changed 12 years ago by Sam

Just change tmp to values

comment:2 Changed 12 years ago by brandon

Resolution: fixed
Status: newclosed

Fixed in Rev [3649].

Note: See TracTickets for help on using tickets.