I'm creating an application in HTML and I want to select all text in webpage textbox using JavaScript.
all text Selection in HTML textbox using javascript
2589
06-Dec-2012
Updated on 06-Dec-2012
Vijay Shukla
06-Dec-2012that code will help you for solving your problem.
<html> <head> <script type="text/javascript"> function allSelection(val, id) { document.getElementById(id).value = val.replace('$', ''); val = document.getElementById(id).value; var ctrl = document.getElementById(id); pos = ctrl.value.length; ctrl.setSelectionRange(0, pos); } </script> </head> <body> <input type=='text' id='t1' value="AllSelection" onclick='allSelection(value, id)'/> </body> </html>