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

前端 未结 6 1557
挽巷
挽巷 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:45

    Hey Jon, not too sure about the performance of this, but this should work:

        $(function() {
    
    
            // Contents of textboxes will be selected when receiving focus.
            $("input[type=text]")
                .focus(function() {
                    var mask = "99/99/9999";
                    $(this).unmask(mask).select().mask(mask);
                });
        });
    

提交回复
热议问题