So let’s assume that I retrieve the page title using javascript, and the value is something like
FrontPage | Website.com
I need only the first word of this, so like FrontPage without any whitespace. I know how to do this with PHP, but how would I do it with javascript?
I need it for this snippet:
$(document).ready(function() {
$("[title='"' + strippedtitle + '"']").addClass("valittu");
});
Try this,
Live Demo