I tried the other two sentences found here to put a space around the word, but each time it led to appearing above the text, not around it.
I have the following code:
<div class="dateCalendar"> June 10 </div>
I am currently using jQuery:
$ ('. dateCalendar'). html (function (i, v) {return v.replace (/ \ s (. *?) \ s /, '$ 1');});
HTML output shows this:
<div class="dateCalendar"> <span></span> June 10 </div>
Ideally, in the end, I would like to wrap the month in between and the date in another run, so that I can put them in css differently.
Some notes that may be helpful in understanding:
- .dateCalendar will be displayed more than once on the page
- The date is encoded in PHP in the Wordpress plugin, which I cannot change
source share