Jump to content

selecting text in a text box


MadPotato

Recommended Posts

first i want to appologise, since i could find my answer in a google search or something...but my lack of english skill simply keep me from finding the answers, so i decided to ask hereit's quite simple, i want to highlight (select) the text in a text box...actualy a noob question :) but i cant do it :)

Link to comment
Share on other sites

In an input button, put this.<input type=button value="Highlight All" onClick="java script:this.form.txt.focus();this.form.txt.select();">where the name(or id?) or the textarea is 'txt'. :)

Link to comment
Share on other sites

I think it's name. When you use id you have to use the document.getElementById('your_id') function...

Link to comment
Share on other sites

thanks 4 the helpand about name/id, i use both (name="txtBox" id="txtBox"), and getElementById()...in IE 6 if you got only 'name', getElementById() works as well, with an extra advantage of input the name/id by a string, what allow to call dinamicaly the objects(using a 'for' to get all text1, text2, text3...text10, for example)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...