Results 1 to 11 of 11
Related
-
HTML input question, how do I add an input field to a single URL? Forum: HTML Forum
Replies: 15 -
onclick help Forum: Javascript Forum
Replies: 3 -
onClick on php? Forum: PHP Forum
Replies: 1
-
08-22-2003, 06:39 AM #1
Autoselect predefined input-value onClick.
Hello @ all,
the following problem has not let me sleep for quite some time now.
Using a form with input fields (text) and a predefined value is no problem.
<input value="Bob" name="example"></input>
What I want to do is, later when I click into the input field, where the string Bob ist aready written, I would like this text-string to be selected. This way it can be overwritten instantly.
At the moment I still have to press backspace and delete it manually. Another possiblity would be that the contents "Bob" is deleted automatically onClick.
One way or the other - I would like to make filling out the form faster and more user friendly.
Your help is greatly appreciated.
-
08-22-2003, 06:52 AM #2
Hi there ,
would this work okay -
Code:<input value="Bob" name="example" onfocus="if (this.value=='Bob') this.value='';" />
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
08-22-2003, 06:55 AM #3
WOW! Works like a charm - and neater than my select and overwrite-thingy
Thank you very much!
-
08-22-2003, 07:00 AM #4
no problem
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
09-13-2008, 08:59 AM #5
Re: Autoselect predefined input-value onClick.
Great solution. That's exactly what I was looking for also!
-
10-27-2008, 07:48 AM #6
Re: Autoselect predefined input-value onClick.
Hi there,
I'm using SMF forum, and I'm trying to input this code id my source, but I'm keep getting this error
Code:Template Parse Error! There was a problem loading the /Themes/VersatilityDark/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly. You may want to try to refresh this page or use the default theme. syntax error, unexpected T_STRING, expecting ',' or ';'
Code:<input value="Bob" name="example" onfocus="if (this.value=="Bob") this.value="";"/>
Regards
-
10-27-2008, 09:31 AM #7
Re: Autoselect predefined input-value onClick.
I don't know what is causing the original error, but the changes you mentioned will only cause more errors. Put the single quotes back.
-
10-27-2008, 10:15 AM #8
Re: Autoselect predefined input-value onClick.
Erm, my bad.
I meant with double quotes there's no error, but wont work, and with single quotes there's error
Sorry
-
10-28-2008, 09:45 AM #9
Re: Autoselect predefined input-value onClick.
Could you show me the line before and the line after?
-
10-28-2008, 09:49 AM #10
Re: Autoselect predefined input-value onClick.
I've solved it with
Code:<input value="Bob" name="example" onfocus="if (this.value== \'Bob\') this.value=\'\';" />
-
10-28-2008, 09:51 AM #11
Re: Autoselect predefined input-value onClick.
No problem. Glad you were able to get it working.
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum