Thursday, 6 June 2013

Create a Success Message using Dynamic Action - Second

You can extend this simple example by adding a counter to it and close it after the specified number of seconds:

var my_counter = 5;

var success_message = $('#P299_MESSAGE').val() + '<br/>' 
+ 'This message will close in ' + 
'<span id="my_sec">' + my_counter + '</span>' + ' seconds.';
$('.t10messages').append(<div class="t10success" style="display: none;">

var time_in_seconds = setInterval(function() {



if (my_counter == 0) {
}, 1000);

Using jQuery this is quite easy to acomplish.


Marko Gorički said...
This comment has been removed by the author.
Marko Gorički said...

Hi Deneš,

I think that your code will add additional div with class t10messages into div with class t10messages :)

$('.t10messages').append('<div class="t10messages">
<div class="t10success" style="display: block;"></div></div>');

You can write this part shorter, e.g. :

$('.t10messages').empty().append('<div class="t10success" style="display: none;"></div>');

Marko Goricki

Denes Kubicek said...

Hello Marko,

sure. I did the correction. Thanx.


Sinelogix said...
This comment has been removed by the author.
gta san andreas pc said...

sure. I did the correction. Thank.