Say I have this for example:
$(function() {
var seconds = 142.097019375;
seconds = seconds.replace(/\.[0-9]*/, '');
alert(seconds);
});
This wont work, but if seconds was $('.seconds').html(); it would replace it, is there anyway to perform a regex on a jquery variable as such.
It’s not working because the Number object doesn’t have a
.replacefunction.Use
seconds = seconds.toString().replace(/\.[0-9]*/, '');