Jump to content


Photo

[SOLVED] onblur/onhover text field value


  • Please log in to reply
5 replies to this topic

#1 abch624

abch624

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 08 June 2009 - 02:04 PM

Hi Guys,

I have seen a lot of site have text in their fields when the user has not focused on that field and once they focus on it the text disapears. But when they enter their data/value then that value is dissplayed.

I have googled this but dont get a proper free script.

Any of you know a script I can use?

Cheers - Zahid

#2 Axeia

Axeia

    Advanced Member

  • Members
  • PipPipPip
  • 717 posts
  • LocationThe Netherlands

Posted 08 June 2009 - 02:42 PM

untested guesstimate:
<input type='text' value='whatever' onfocus='this.value=""' onblur='this.value == "" ? "whatever" : this.value' />

Post PHP code like this: [php]#PHP code goes here.[/php]
And everything else like: [code]//codes goes here.[/code]

#3 abch624

abch624

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 08 June 2009 - 02:43 PM

I found it.

http://grzegorz.fryd...toggleformtext/

What you provided is not what I wanted.

Cheers

#4 gevans

gevans

    Advanced Member

  • Members
  • PipPipPip
  • 2,653 posts
  • LocationUK

Posted 08 June 2009 - 02:45 PM

Actually Axeia's code is exactly what you wanted. Working identically to the script you found
I like starting my code with session_start();

ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

Son of a biscuit eating bulldog

Use [code][/code] tags!!

#5 Axeia

Axeia

    Advanced Member

  • Members
  • PipPipPip
  • 717 posts
  • LocationThe Netherlands

Posted 08 June 2009 - 04:26 PM

Indeed, would be advisable to use as well unless you already included jquery on the same page for other purposes as adding a big lib for something that simple just adds weight for no good reason.
Post PHP code like this: [php]#PHP code goes here.[/php]
And everything else like: [code]//codes goes here.[/code]

#6 abch624

abch624

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 08 June 2009 - 04:29 PM

I am already using Jquery heavely so doesnt affect the load.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com