Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to use keypress event in asp.net c# because events not containing any keypress event.

What I have tried:

I have used an html input box and used its onkeypress event to call client script and tried to call code behind function but it did not work then I use button click from client script and in button click i used search function functionality but after keypress it is working but textbox is losing focus. when i am using textbox.focus then while focusing cursor is setting at starting position and i want it to end of text.

thanks
Posted
Updated 2-Oct-17 23:24pm

1 solution

You can use the below code in your JavaScript to achieve what you are trying. Use your control's id instead of 'foo'.

var textbox = document.getElementById('foo');
textbox.focus();
textbox.value = textbox.value;
 
Share this answer
 
Comments
Karthik_Mahalingam 3-Oct-17 5:51am    
5
Atlapure Ambrish 3-Oct-17 10:25am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900