Putting cursor at end of textbox in javascript

前端 未结 3 1046
野趣味
野趣味 2021-01-18 02:07

I have a textbox that when I put on focus I want the cursor to goto the end of the textbox.

The solution that keeps coming up is just

this.value = t         


        
3条回答
  •  青春惊慌失措
    2021-01-18 02:13

    Simple And Working 100%

    1.Focus
    2.Take the value
    3.Empty It
    4.Put the value back 
    
    
    
            $("#catg_name").focus();
            var value = $("#catg_name").val();
            $("#catg_name").val('');
            $("#catg_name").val(value);
    

提交回复
热议问题