Jump to content

Moving a cursor upon focus to the last character


moose-en-a-gant

Recommended Posts

I have this input where 8 characters are already filled in and upon focus, the cursor should be flashing at the end of the last character.

 

I found this page

 

http://stackoverflow.com/questions/4609405/set-focus-after-last-character-in-text-box

 

Tried to use this, any thoughts?

(function($){
    $.fn.setCursorToTextEnd = function() {
        var $initialVal = this.val();
        this.val($initialVal);
    };
})(jQuery);

$('#writer').setCursorToTextEnd();

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.