Side navigation
#8679 closed bug (patchwelcome)
Opened March 28, 2011 03:46PM UTC
Closed March 28, 2011 07:00PM UTC
Last modified March 14, 2012 04:04PM UTC
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: |
Description
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',
function(e){
$(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?
Attachments (0)
Change History (4)
Changed March 28, 2011 05:09PM UTC by comment:1
Changed March 28, 2011 07:00PM UTC by comment:2
_comment0: | Thanks for submitting a ticket to the jQuery Bug Project.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. → 1301339354261686 |
---|---|
component: | unfiled → selector |
priority: | undecided → low |
resolution: | → patchwelcome |
status: | new → 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.
Changed March 28, 2011 11:30PM UTC by comment:3
Many thanks for the work around!
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.