I want to add and remove a class to a div on the basis of time. It should add a class after 6 secs and remove it after 4 secs. I tried a basic implementation. why isn't this working? I assume the problem is two setTimeouts together like this. If I comment out the second line the first one works. What is happening here?
setTimeout(addHighlight(), 6000);
setTimeout(removeHighlight(), 10000);
Can somebody show me how i can write a single function that does both(add and remove class) on the basis of a delay
parameter?