You are here

18 April 2016

How to focus and select all using javascript. This snippet shows it in an example of "jQuery: Toggle input text using checkbox". For an example you can extend this to any event or action where you need to show prefilled text input.

Source code viewer
  1. (function($){$().ready(function(){
  3. $('#auto-list').click(function(){
  4. $('input[name="auto_list_name"]').toggle(0, function() {
  5. $(this).focus().select();
  6. })
  7. });
  9. });})(jQuery);
Programming Language: jQuery