For example if I have
<span class=lwn0>
Jul 6 - Sep 6
</span>
<span class=lwn0>
Jul 7 - Sep 7
</span>
But I only want Jul 6 and Jul 7. How do I get rid of the " - Sep 6" and " - Sep 7" using jQuery?
Posted 06 July 2015 - 11:58 AM
<span class=lwn0>
Jul 6 - Sep 6
</span>
<span class=lwn0>
Jul 7 - Sep 7
</span>
Posted 06 July 2015 - 01:20 PM
Posted 21 July 2015 - 04:54 AM
$(".lwn0").text(function() {
return $(this).text().replace(/-.+$/m, '');
});
$(".lwn1").text(function() {
var txt = $(this).text();
return txt.substring(0, txt.indexOf("-"));
});
