Guest User

Untitled

a guest
Jun 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. $("#txt1").select();
  2.  
  3. $("input[type=text]").focus(function() {
  4. $(this).select();
  5. });
  6.  
  7. //code....
  8.  
  9. $("#txt1").focus();
  10.  
  11. //some code here to deselect the contents of this textbox
  12.  
  13. $("input").focus(function(){
  14. this.selectionStart = this.selectionEnd = -1;
  15. });
  16.  
  17. $("input[type=text]").focus(function() {
  18. if($(this).skipFocus) return;
  19. $(this).select();
  20. });
  21.  
  22. //code....
  23.  
  24. $("#txt1").skipFocus = true;
  25. $("#txt1").focus();
  26.  
  27. $(your_input_selector).attr('disabled', 'disabled');
  28. $(your_input_selector).removeAttr('disabled');
  29.  
  30. $(document).ready(function(){
  31. $('#txt1').focus(function(){
  32. setTimeout(function(){
  33. // set selection start, end to 0
  34. $('#txt1').attr('selectionStart',0);
  35. $('#txt1').attr('selectionEnd',0);
  36. },50); // call the function after 50ms
  37. });
  38. });
Add Comment
Please, Sign In to add comment