Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everyone

I've a error message div that contains dynamic errors. And a button on click replace error message with custom text and after 3 second it fadeOut and original error message appear.

Please help how can I achieve this. The condition is that I've only a div for all this.
Posted
Comments
[no name] 18-Apr-14 8:54am    
If you already have this as you say, what is the problem?
Ravi K.Singh 18-Apr-14 9:02am    
I'm not getting the exact solution. Here is link : http://jsfiddle.net/NMgnw/124/
[no name] 18-Apr-14 9:32am    
The "exact solution" to what? All you have described is what you currently have. You have said nothing about any kind of a problem or asked any question.
vbmike 18-Apr-14 9:53am    
I think you may be using clone() incorrectly. You should consult jquery.com api documentation.

1 solution

You could use the delay correct ? and I am not sure why you are using the clone as you have two different divs.. try the below script


JavaScript
$(document).ready(function(){
    $('.msg1').fadeIn('3000')
   
    $('.btn2').on('click', function(){
        $('.msg1').hide();
        $('.msg2').fadeIn();
        $('.msg2').delay(2500).fadeOut(800);
        $('.msg1').delay(4000).fadeIn(800); 
    });
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900