JavaScript Add then remove class after delay but without page refresh if hasclass then remove class jquery,add class then remove

I am adding a class .error on click and now after time interval of 2 seconds I want to remove this class, but without page reload/refresh.I used delay() in jQuery as:

$('#username').addClass('error').delay(2000).removeClass('error');

but it's not working.

Then I tried setTimeout().

It's working, but reloading page. I want something that would add, and then remove, class after specific time but do not refresh/reload the page.

Please help, and thank you in advance.

Answer:1

I am trying make a responsive page with three div(each div is a column), where one column is sometimes hidden.What I aim to implement is: 1.When three divs are shown, width should be 100%. When one ...

I am trying make a responsive page with three div(each div is a column), where one column is sometimes hidden.What I aim to implement is: 1.When three divs are shown, width should be 100%. When one ...

  1. auto adjust width excel
  2. auto adjust width css
  3. auto adjust width in html
  4. auto adjust width of columns in excel
  5. auto adjust width excel shortcut
  6. auto adjust width of cells in excel
  7. auto adjust width
  8. auto adjust width vba

I have a task to create a node.js script that listens in a directory for new archive files to arrive and process them. I see that I can do this with fs.watch. The files are tar.gz archives, that ...

I have a task to create a node.js script that listens in a directory for new archive files to arrive and process them. I see that I can do this with fs.watch. The files are tar.gz archives, that ...

  1. node watch directory for changes
  2. node watch directory
  3. node-sass watch directory
  4. node.js watch directory for new files
  5. node fs watch directory
  6. node js watch directory
  7. node red watch directory
  8. node.js watch directory for changes
  9. node forever watch directory
  10. node.js fs.watch directory

I have a form with two select html tags and an input submit. To populate the value of option tags and to display the equivalent values of selected option tag, I use PHP, please see snippet below. Now,...

I have a form with two select html tags and an input submit. To populate the value of option tags and to display the equivalent values of selected option tag, I use PHP, please see snippet below. Now,...

  1. ajax foreach data
  2. ajax foreach json data
  3. ajax foreach loop json
  4. ajax foreach php
  5. ajax foreach result
  6. ajax foreach response
  7. ajax foreach table
  8. ajax foreach html
  9. ajax foreach jquery
  10. ajax foreach append
  11. ajax foreach object
  12. ajax foreach function
  13. ajax foreach id
  14. ajax foreach request
  15. ajax foreach error
  16. foreach ajax call
  17. foreach ajax success
  18. foreach ajax laravel
  19. foreach ajax javascript
  20. foreach ajax return

I would like to count values inserted into a form without refreshing the page. The below code works well if all of the inputs have "name='test'" set the same but I need name to be unique to process ...

I would like to count values inserted into a form without refreshing the page. The below code works well if all of the inputs have "name='test'" set the same but I need name to be unique to process ...

  1. jquery count input values
  2. how to count input values in javascript