I am facing an issue where I need to format only the date in a specific string. I have managed to extract the date and store it in a variable after isolating it from the original message.
<div class="foo"><p> Click here now and get by January 1st </p></div>
Despite successfully creating the variable for the date, I am struggling to bold this substring. I attempted to apply CSS styling directly to the variable but it did not work as expected:
var fullMessage = $('.foo p').text();
var justTheDate = fullMessage.substring(fullMessage.indexOf('get by') + 7);
$(justTheDate).css("font-weight","700");
Is there a way to achieve this formatting?