0

Hello all,
I'm trying to get a calculation to appear in a DIV, in HTML. The calculation shows fine with the HTML, but my problem is that the result is showing straight away. I want it to display 5 seconds after the calculation is done (it's done in jquery).

What do I need to change to get this working? I looked on google and it said to use delay but it isn't working.

$("#result").show().delay(5000).html("<p>Your BMI result is:"+ ++bmi + "</p>");

By the way, if your wondering why I use show, it's because the div is hidden using jquery using hide().

I would appreciate it if someone tells me how to make the 5 second delay.

Cheers,

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by bsewell
0

You have the right idea, but your sequence is off:

$("#result").hide();
$("#result").html("<p>Your BMI result is:</p>").delay(5000).fadeIn();‚Äč

You can see it in action here: http://jsfiddle.net/kc5T9/8/

Also if you want it to fade in a little slower you can use

fadeIn(500);

Hope this helps.

0

Hi Dschuett,
I managed to get the problem solved using a slightly different approach

$("#result").html("<p>Your BMI result is:"+ ++bmi + "</p>");
     $("#result").delay(5000).show(0);

Thanks for your help :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.