How can I make jquery wait for one function to finish before executing another to update row colors? -


I am using the jquery UI sortable when the rows are reconstructed, then I change the line colors to the zebra stripe I want to reset. I'm using this code.

  function reset_root () {$ ("# rank toddy tr"). RemoveClass ("row1", "row2"); $ ("#RankTit:"). Adclass ("line 1"); } $ ("# Rank dune") Sorted ({update: function () {reset_rows ();}}); The  

function adds the correct line color, then immediately removes all. How do I get jquery to remove the first row sections, then add row 1 class to the rows? This first line joins 1 square regardless of which code I use the function.

I'm surprised that your CSS or something like that, because it should work basically. I think I'll do it in a slightly different way, though:

  $ ('tooby'). RemoveClass ("tr: odd"). RemoveClass ("AddClass" ("weird"); $ ('tr: even'). RemoveClass ("weird"). AddClass (" Even ");}});  

(Clearly you would like to include those selectors a bit, I've done everything on my example page.)

You don actually need two sections (if I am reading it wrongly and you are not actually using two classes, I apologize), you here Till that Etc.), which makes it easy:

<("Tr: strange"). RemoveClass ("Even"); $ ('tr: even'). AddClass ("Even");}}); Off-topic, but I think you're doing it with javascript and sections because you have to support browsers which they can not do directly. With CSS nth-child pseudo class and so on ... (Unfortunately, IE6 is still the reality of life, is not it? :-))


Comments