I need to break apart a string that always looks like this:
something — something_else.
I need to put “something_else” in another input field. Currently, this string example is being added to an HTML table row on the fly like this:
tRow.append($('<td>').text($('[id$=txtEntry2]').val()));
I figure “split” is the way to go, but there is very little documentation that I can find.
Documentation can be found e.g. at MDN. Note that
.split()is not a jQuery method, but a native string method.If you use
.split()on a string, then you get an array back with the substrings:If this value is in some field you could also do: