Bug Tracker


Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#8679 closed bug (patchwelcome)

Jquery live with select method problem in internet explorer

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


I want to use jquery live() to automatically select the text in a text box but it doesn't seem to work in internet explorer 8. Here's the code:

<!DOCTYPE html PUBLIC "-W3CDTD HTML 4.01 TransitionalEN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script> <script type="text/javascript"> $(function(){

$('input.textInput') .live('focus',


$(this).select(); alert(1) if i uncomment this it works


}); </script>

</head> <body> <input type="text" class="textInput" value="0,00" /> </body> </html>

If, however, i uncomment the "alert(1)" statement it does work. Any ideas what the problem is here?

Change History (4)

comment:1 Changed 6 years ago by timmywil

You can do this instead: http://jsfiddle.net/timmywil/m9Pyu/1/ The setTimeout with a time of 0 places the .select at the bottom of the stack, allowing you to select after IE runs it's code to focus on the input.

comment:2 Changed 6 years ago by addyosmani

  • Component changed from unfiled to selector
  • Priority changed from undecided to low
  • Resolution set to patchwelcome
  • Status changed from new to closed

Thanks for submitting a ticket to the jQuery Bug Tracker.As per timmywil's suggested workaround, you can easily use setTimeout to avoid the issue you're experiencing with IE8. Unless we find that a significant number of other users are also running into the same problem attempting such behavior using live with IE, we'll be closing this ticket as patch-welcome for now.

Last edited 6 years ago by addyosmani (previous) (diff)

comment:3 Changed 6 years ago by anonymous

Many thanks for the work around!

comment:4 Changed 6 years ago by timmywil

#9871 is a duplicate of this ticket.

Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Modify Ticket

Change Properties

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.