I have a simple auto complete where I'd like to make changes to the result display.
Here is the basic code.
This currently works fine, but I'd like to make the results alternatively highlight every row. So if the letter m was entered, this might appear:
Maggie (highlighted in color 1 or with class 1)
Margaret (highlighted in color 2 or with class 2)
Mary (highlighted in color 1 or with class 1)
Can someone tell me how I might accomplish this?
I believe that CSS3 has an :nth-of-type(odd) selector, so you should be able to make good use of that to color every odd one, with another default color that would apply to the even ones.
You are right, and that is what I thought to do too, but I don't know what to hook the css to. I don't know what class to apply it to (if there even is one). Do you have any thoughts here?
Do you have an example of the page as it currently is?
There's not much to show. I am testing out jquery autocomplete before I integrate it into the actual site. It's just a totally bare bones page with jquery included and a form field.
I can add anything to it you might suggest. I was hoping that jquery might have provided the means to do this though and I was just overlooking something I could hook my css onto, but I don't know.
Yes, jQuery provides a means to do that, with its :odd selector.
This topic is now closed. New replies are no longer allowed.