<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...
| |
|
Welcome to KnowledgeSutra - Dear Guest | |
Select All Text In A Form Field On Click
Started by Amezis, Oct 03 2005 10:51 AM
4 replies to this topic
#1
Posted 03 October 2005 - 10:51 AM
Hi, I have made a script which generates a BBcode when you run it, and displays it in a text field, like this:
#2
Posted 03 October 2005 - 12:26 PM
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.
And then for each field that you want to select all the text in when clicked, add this 'onClick' action.
Hope that helps.
Set up a function in between the <head> </head> tags of your page like this.
<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.
<input type="text" name="bbcode" size="81" value="[IMG]<?php echo $url; ?>[/IMG]" onClick='highlight(this);'>
Hope that helps.
#3
Posted 28 July 2009 - 11:19 PM
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 gnucomReply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users














