Skip to main content

Bug Tracker

Side navigation

#8439 closed bug (wontfix)

Opened March 03, 2011 10:26PM UTC

Closed March 03, 2011 10:39PM UTC

Last modified March 03, 2011 10:48PM UTC

$(input element).val() returns reversed string under certain conditions

Reported by: anonymous Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
Description

(Bug occurs on Firefox 3.6.14 (but not on Opera 11.01), using Google's jQuery 1.5.1.min).

Bit of an obscure one, this.

Run the code below, and type a string. The string will be echoed to the screen reversed.

Change the font-size near the end to anything other than 0, and rerun. The string will be echoed to the screen correctly.

Whu?

<html>
 <head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
  <script type="text/javascript">
   $(function()
   {
    $('#passwordInput').keydown(function(event)
    {
     $('#term_pass .display').text(  $('#passwordInput').val()   );  
    });
    $('#passwordInput').keyup(function(event)
    {
     $('#term_pass .display').text(  $('#passwordInput').val()   );  
    });
    
    $('#passwordInput').focus();
   });
  </script>
 </head>


 <body>
  Password:
  <div id="term_pass">
   <span class="display"></span>
  </div>

  <form>
   <input style="font-size: 0px;"  type="password" id="passwordInput"/>
  </form>
 </body>
</html>

Why would the font-size of an input box influence the string contained within?

Not sure whether the bug is me, jQuery or Firefox.

Attachments (0)
Change History (3)

Changed March 03, 2011 10:27PM UTC by anonymous comment:1

Bugger. I didn't see the jsFiddle warning until I submitted, and now I can't edit it. Sorry.

Changed March 03, 2011 10:39PM UTC by rwaldron comment:2

component: unfiledattributes
priority: undecidedlow
resolution: → wontfix
status: newclosed

Confirmed: http://jsfiddle.net/rwaldron/fd6xV/1/

As you can see, this is not a jQuery bug

Changed March 03, 2011 10:48PM UTC by anonymous comment:3

Ah, thank you. I'll resubmit to Firefox.