Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery focus input end of text

<input type="text" id="Search" value="Hello" />

var searchInput = $('#Search');

// Multiply by 2 to ensure the cursor always ends up at the end;
// Opera sometimes sees a carriage return as 2 characters.
var strLength = searchInput.val().length * 2;

searchInput.focus();
searchInput[0].setSelectionRange(strLength, strLength);
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to pass data between components in react 
Javascript :: conditional style react native 
Javascript :: node js sqlite3 
Javascript :: replace all character in string javascript 
Javascript :: js loop over array of objects extract value 
Javascript :: how to remove an object from array in react native 
Javascript :: react native textinput no keyboard 
Javascript :: react cheat sheet 
Javascript :: change px string to number 
Javascript :: mongodb sort objectid 
Javascript :: what is synchronous and asynchronous in javascript 
Javascript :: dynamic route vue 
Javascript :: angularjs round to 2 decimal places input 
Javascript :: add item to array in javascript 
Javascript :: electron preload to renderer 
Javascript :: js browser tab inactive check 
Javascript :: how to check hover effect in js 
Javascript :: how to use the onload event n vue js 
Javascript :: generate random string react 
Javascript :: array length javascript 
Javascript :: how to calculate the time complexity of a recursive function 
Javascript :: jquery make visible 
Javascript :: angular submit with required 
Javascript :: change datetime format in js 
Javascript :: Find a vowel at the begining and end with regular expression 
Javascript :: varchar max length 
Javascript :: get external api node js 
Javascript :: react lazy import non default 
Javascript :: window.scrollto(0 0) not working 
Javascript :: duplicate numbers in an array javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =