javascript onclick select all text in a form field
Webmasters: If you have a web page related to this topic, Click here to Add Your Link.
Reply Your Comments: Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend CLick this button if you want to send this page to a friend.
Subscribe to RSS CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
javascript onclick select all text in a form field
Post Description: javascript onclick select all text in a form field Javascipt
Post Tags: This Post Has Been Viewed 886 Times Since Wed Sep 24, 2008 11:22 am Author hostman with 5 replies
javascript onclick select all text in a form field
Advertise On This Page
onClick="select_text();"
ok. lets say i have a field, and as soon as you click on that field, you want all the text contained within the field to be selected automatically. well, you can do that with javascritp on this tutorial i will show you how you can do that.
here is the demonstration example
and here is the code i used:
<script type="text/javascript">
function select_text()
{
var content=eval("document.myform.field");
content.focus();
content.select();
}
</script>
<form method="post" action="" name="myform" >
<textarea name="field" rows="4" cols="40" onClick="select_text();">Click Inside the text area to select all
text within this form field </textarea>
</form>
hope you learned something from this short and useful tutorial
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Webmasters - Exchange Links With Us. Add related websites to this topic
Links Related to : javascript onclick select all text in a form field
Comments and replies About javascript onclick select all text in a form field
:: 1 :: Reply #83824 Reply By wallpaperama On Fri Nov 28, 2008 11:06 am
wallpaperama:
another way you can do this:
follow my steps:
1. i am using windows xp, so open a blank notepad.
2. copy and past this code into the blank notepad: