[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 383
  • Last Modified:

multiple function call does not work in jquery

I have a span on my webform and it has a class.
Now based on user action I need to remove that class and after few seconds add that same class back.
I added this code but it does not work.
Now sure what mistake  I am doing here
I am using jquery 1.11.0 version

$("#spanSaved").removeClass("hidden").addClass("hidden", 2000);

Open in new window

0
yadavdep
Asked:
yadavdep
  • 3
1 Solution
 
RobOwner (Aidellio)Commented:
Demo for you: http://jsbin.com/liqefa/1/edit

$(function() {
	$("#saveme").on('click', function() {
		console.log('here');
		$("#spanSaved").removeClass("hidden");
		setTimeout(function() {$("#spanSaved").addClass("hidden")}, 2000);
	});
});

Open in new window

0
 
leakim971PluritechnicianCommented:
$("#spanSaved").removeClass("hidden").delay(2000).addClass("hidden"); // http://api.jquery.com/delay/
0
 
RobOwner (Aidellio)Commented:
leakim971... i tried that too but it doesn't work.  the delay is only chainable with animations
0
 
yadavdepAuthor Commented:
I agree with Rob (tagit)
0
 
RobOwner (Aidellio)Commented:
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now