I found this snippet somewhere and it works like a charm:
var n = parseInt(e.find(span.favNum).text().replace(/./g, )) + 1;
If I do it in a similar way it doesn't work anymore.
I do the following:
<div id =test>6.987</div>
var test = $(#test);
var r = test.text().replace(/./g, );
console.log(wrong , r);
I know that I can replace it also like this:
var r = test.text().replace(., );
This works.
I would like to understand why the stolen snippet is working.
Any idea?
The original script is found here: http://wp-svbtle.themeskult.com/
You will find the snippet by viewing the source of index.html and searching for .replace
.