$('.old').live('focus', function() { $(this).select(); }); $('.new').live('mouseup', function() { $(this).select(); });
body { color:#222; background:#fafafa; } h2 { color:#999; margin:25px 0 0 0; font-size:1.6em; } #wrap { width:300px; margin:1em auto; padding:0 1.5em 1.5em 1.5em; background:#fff; border:1px solid #eee; }
<div id="wrap"> <section> <h2>focus</h2> <input value="foo" class="old"> <h2>mouseup</h2> <input value="bar" class="new"> </section> </div>