I am looking to customize specific characters within my <code> tag. While searching online, I came across the .replace() function but encountered issues when trying to style numbers. My goal is to change their appearance without altering the text itself.
Below is the code snippet I am working with:
HTML
<code> $years = floor($diff / (365*60*60*24)); </code>
JS
('code').each(function()
{
var text = $(this).text();
var setan = text.replace(/\d+/g,'<int>'+'\d'+'</int>');
$(this).html(setan);
});
The current output is
$years = floor($diff / (d*d*d*d));
I aim to achieve an outcome like
$years = floor($diff / (<b>d</b>*<b>d</b>*<b>d</b>*<b>d</b>));