jQuery masked input plugin. select all content when textbox receives focus

前端 未结 6 1541
挽巷
挽巷 2021-01-02 05:14

This is a followup question to this question:

select all contents of textbox when it receives focus (Javascript or jQuery)

Basically I am using a textbox in

6条回答
  •  执笔经年
    2021-01-02 05:29

    its working for me in FF3.

    $("input[type=text]").focus(function(e) {
      var that = this;
      setTimeout(function(){$(that).select();},10);
      return false;
    });
    

    setTimeout will "queue" the select() execution, I was wondering about: - Ok mask functions do your work THEN I'll select the content. That THEN is where the queue is useful.

    Just an idea. I hope it works as expected.

提交回复
热议问题