Dimitri Danilov Dimitri Danilov - 1 year ago 64
jQuery Question

How can I insert before a text without having any marker?

I have this html :

<th class="fc-day-header fc-widget-header fc-sat" data-date="2016-10-01">samedi 1 octobre</th>

And I want to insert something before
samedi 1 octobre

I already tried prepend() but it doesn't seems to work; the text disappears.

Have any ideas?

Answer Source

You can just add to the text that is already there

$('.fc-day-header.fc-widget-header.fc-sat').text(function(_,txt) {
    return 'Some text' + txt;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download