The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Default Text In Search Box Area

Go down

Solved Default Text In Search Box Area

Post by runawayhorses February 13th 2013, 2:51 am

How do you write this code so the text will disappear once the user clicks on the input area, and also that it will reappear if the user clicks somewhere else? Right now the default text is "Search..." and it stays there until someone starts to write something into the search, they have to press and actual letter on there keyboard before the default text disappears. In short and the easiest way to explain this is by example, see the little search box on the right-hand side above the widgets area here just above the google+ twitter and facebook like count buttons on this forum? I want it to behave like that, when you click into the text area the "Search..." text disappears, and when you click out of it it reappears again.

Code:
    $(window).load(function() {
    document.getElementById('fa_search').getElementsByTagName('input')[0].setAttribute('placeholder','Search...');
    });
avatar
runawayhorses
Hyperactive

Male Posts : 2537
Reputation : 166
Language : English
Location : United States

View user profile http://runawayhorses.alldiscussion.net/

Back to top Go down

Solved Re: Default Text In Search Box Area

Post by runawayhorses February 13th 2013, 2:58 am

Nope its not doing it, you can check it on my forum here:

Edit: I should mention its for the toolbar search box.

http://runawayhorses.alldiscussion.net/
avatar
runawayhorses
Hyperactive

Male Posts : 2537
Reputation : 166
Language : English
Location : United States

View user profile http://runawayhorses.alldiscussion.net/

Back to top Go down

Solved Re: Default Text In Search Box Area

Post by runawayhorses February 13th 2013, 3:08 am

Excellent! Its working perfectly, thanks rideem. Smile
avatar
runawayhorses
Hyperactive

Male Posts : 2537
Reputation : 166
Language : English
Location : United States

View user profile http://runawayhorses.alldiscussion.net/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum