[pmwiki-users] searchbox that clears

Petko Yotov 5ko at 5ko.fr
Mon Apr 9 02:15:48 CDT 2012

On Monday 09 April 2012 00:05:52 adam overton wrote:
> 	onfocus=\"if(this.getAttribute('class').indexOf('clear')!=-1)
> holdValue=this.value; this.value=''\"
> onblur=\"if(this.getAttribute('class').indexOf('clear')!=-1)
> this.value=holdValue;\" />";

A small information: you don't need to store and hold the default value, you 
can use this.defaultValue. Additionnally, you may not want to wipe the field 
if a user whote something in it:

  if(this.value=='') this.value=this.defaultValue;


More information about the pmwiki-users mailing list