Hi,
The ugly thing I’ve done
var str = 'Your confirmation was successful 5 seconds to redirect to login page';
var newstr = str.replace(/(\\d)/, "$1-1");
What’s the right way ?
Bye
Hi,
The ugly thing I’ve done
var str = 'Your confirmation was successful 5 seconds to redirect to login page';
var newstr = str.replace(/(\\d)/, "$1-1");
What’s the right way ?
Bye
Advice for what? Does it work?
I managed this code
function countDownRedirect(sel){
var sec,re = /(\\d)/;
var str = $(sel).text();
var found = str.match(re);
if(null === found){return;}
sec = found[0];
var intervalId = setInterval(f,1000);
function f(){
var newstr = str.replace(/(\\d)/, function(s, p) {
return p-1;
});
if(sec>0){
str = newstr;
sec--;
$(sel).text(newstr);
}
else{
clearInterval(intervalId)
}
}
}
Do you have any advice ?
Thanks for the code and for the english as well
var str = 'Your confirmation was successful 5 seconds to redirect to login page';
var newstr = str.replace(/(\\d)/, function(s, p) {
return p-1;
});
The English is pretty bad though. I’d change it to this: ‘Your confirmation was successful. In 5 seconds you will be redirected to the login page.’;