Click here to Skip to main content
16,004,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody I want to select all value from textbox when I click on this textbox in asp.net using j query. Same as windows application there is one property for textbox which is txtName.SelectAll() I want to use same functionality in ASP.Net.
Please help me
Posted
Comments
King Fisher 1-Dec-14 6:09am    
what have you tried?
Ajay Shedge 1-Dec-14 6:23am    
I have one text box and I entered abc in textbox. If again I clicked on this text box i want to select all text. which is I entered in text box means I have entered "abc".

1 solution

Try this (txtID is your control ID):

JavaScript
function selectAll(txtID) {
$(txtID).setSelectionRange(0, $(txtID).val().length)
}


Next time search for the solution before asking for easily found answers.


If this helps please take time to accept the solution. Thank you.
 
Share this answer
 
v2

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