How do I wrap a span around the last word of an element's inner text, using jQuery?

I know this should be a simple task but I'm having problems selecting a heading elements last word and wrapping that in a span so I can add style changes.

Here's what I have so far

$('.side-c h3').split(/\s+/).pop().wrap('<span />');

Any help would be greatly appreciated

5
задан Donald Duck 18 April 2019 в 10:47
поделиться