Javascript – Parsing Text with jQuery

javascriptjqueryparsingtext;

I'm attempting to parse a text string with jQuery and to make a variable out of it. The string is below:

Publications Deadlines:   armadllo

I'm trying to just get everything past "Publications Deadlines: ", so it includes whatever the name is, regardless of how long or how many words it is.

I'm getting the text via a the jQuery .text() function like so:

$('.label_im_getting').text()

I feel like this may be a simple solution that I just can't put together. Traditional JS is fine as well if it's more efficient than JQ!

Best Answer

Try this,

Live Demo

First part

str = $.trim($('.label_im_getting').text().split(':')[0]);

Second part

str = $.trim($('.label_im_getting').text().split(':')[1]);