Link to home
Start Free TrialLog in
Avatar of sabecs
sabecs

asked on

JavaScript function required for form onfocus and onblur

I have a form as below, onfocus and  onblur where previously working but not anymore.

Can anyone provide a JavaScript function to do the same thing and should I try loading at the bottom of the page.

Thanks in advance


<form action="members-search" method="GET">
<br /> 
<div id="get_my_location" class="ui-widget"><label for="suburb">Where do you need a Service Professional?</label><br /> 

<input type="text" value="Enter Post Code or Suburb" name="suburb" id="suburb" 

onfocus="if(this.value == 'Enter Post Code or Suburb'){ this.value = ''; }"

onblur="if(this.value == ''){ this.value = 'Enter Post Code or Suburb'; }"> 

<br />
<input id="set_suburb" type="submit" value="Get Started" /></div><br /> 
</form>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sabecs
sabecs

ASKER

Thanks, very much appreciated, I never new about the placeholder HTML5 option, that is perfect.