Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cycling Through words in an input field

Status
Not open for further replies.

imstillatwork

IS-IT--Management
Sep 26, 2001
1,605
US
Hello,

On a lot of sites with a search form, there is a default value in the input field that has an example search term, and when you click the input, the default disappears.

I need to do that, but with a twist...

I need to cycle through a list of words so that they fade in / out until you click the input.

I am using jQuery, so the fading in / out part should be easy right? I am a JS novice at best... I don't understand how to loop the words continuously in a way that I can apply the jQuery fade effects...

Please help! ?

Kevin
 
Let's say you have 4 words in an array. You can use the modulus operator to keep a monotonic index cycling through 0 to 3: i%4 inside a while loop where the value of i is incremented.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top