The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved] ADD and remove class on click but remove class again on reclick

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #38160

    okay here is what i want to happen i have a div right. so currently the div has a class of “cfse_a” however when the div with an id of #cf-search is clicked on i want to remove the class cfse_a and then add cfse_b then when the user clicks anything other then the div i want to remove the class cfse_b. Might seem confusing right take a look at with google chrome then hover over the search box and inspect it you will see on hover it adds a class however on click it removes that class adds another class. Then when anything other then the search box is clicked the script removes the click class hope it’s not too confusing


    As far as I can tell, this is what you are after:


    thanks you solved my problem


    No worries!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.