Loading...


bookmark - Select All Text In A Form Field On Click

Select All Text In A Form Field On Click

 
 Discussion by Amezis with 4 Replies.
 Last Update: May 6, 2010, 1:13 am
 
bookmark - Select All Text In A Form Field On Click  
Quickly Post to Select All Text In A Form Field On Click  w/o signup Share Info about Select All Text In A Form Field On Click  using Facebook, Twitter etc. email your friend about Select All Text In A Form Field On Click Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Hi, I have made a script which generates a BBcode when you run it, and displays it in a text field, like this:

CODE

<input type="text" name="bbcode" size="81" value="[IMG]<?php echo $url; ?>[/IMG]">

Well, anyway, I want something that selects all the text in that form field when you click on it, like it does in ImageShack when you upload...








   Mon Oct 3, 2005    Reply         

Looking at the Imageshack site, this is the way you could do it for your site.

Set up a function in between the <head> </head> tags of your page like this.

CODE

<script language="JavaScript">
function highlight(field) {
       field.focus();
       field.select();
}</script>


And then for each field that you want to select all the text in when clicked, add this 'onClick' action.

CODE

<input type="text" name="bbcode" size="81" value="[IMG]<?php echo $url; ?>[/IMG]" onClick='highlight(this);'>


Hope that helps. :huh:





   Mon Oct 3, 2005    Reply         

These instructions arenSelect All Text In A Form Field On Click

Hello,

 I tried following the instructions you provided to create a textarea with one-click-select-all  behavior in a wordpress article.  I had to include the 

function highlight(field) {        field.Focus();        field.Select();}

in an external file.  When trying to use the highlight(), nothing happens.  Any update to this script?

-reply by gnucom

   Tue Jul 28, 2009    Reply         


These instructions aren Select All Text In A Form Field On Click

function highlight(field) {        field.Focus();        field.Select();}

javascript  is case sensitive...

Should

field.Focus();  Field.Select();

you could  just add to onclick this.Select()

 

 

-reply by philt

   Tue Feb 23, 2010    Reply         

See this link to get the answer
http://www.tutorials99.com

   Thu May 6, 2010    Reply         

Quickly Post to Select All Text In A Form Field On Click  w/o signup Share Info about Select All Text In A Form Field On Click  using Facebook, Twitter etc. email your friend about Select All Text In A Form Field On Click Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Onclick Image gt gt Add Text To...

when some images get clicked, a text should added to an input(textfield). Does someone know how this can be done? I suppose it can be done via javascript. thanks in advance! ...more

   05-May-2005    Reply         

Preventing A Form To Submit If A Fi...

Well, I've just started learning Javascript, so I'm no wiz yet... Anyways, I have a form where I want to show an error message when the user has not filled out the "name" field. My code looks like this:CODE <script type="text/javascript" language="Java ...more

   09-Sep-2006    Reply         

Text Size In quot fill in quot Fo...

Thanks for all the help on my previous question about adding an address to a "Submit" button. I've also been able to add a "print page" button through the help from group members. I now have another question. I've created a form using the Input commands that ...more

   02-Sep-2008    Reply         

Making A Refresh Link On Your Website. refresh local webpage   Making A Refresh Link On Your Website. refresh local webpage (18) (12) Fixed Background Image Just little reminder  Fixed Background Image Just little reminder