So i have pieced together a couple of other peoples code to get it this far but it is having an issue when there are numbers in parts of the html of other elements. What i am trying to do is wrap all numbers on the page in a span. The code i have at the minute:
$(function(){
$('#page').html(function(i, v) {
v = v.text();
return v.replace(/(\d+)/g, '<span class="caps">$1</span>');
});
});
the problem with this though is if i have an image on my page with the file name of something like 'test123.png' it tries to wrap the 123 in a span.
How can i modify this code so that it only uses the text of elements and not the html?
Thanks in advance