i have a selection of (2) elements, selected by this:
$(this).parents("tr:first").children("td").children("span");
when i do this:
$(this).parents("tr:first").children("td").children("span").text();
the texts in the spans (say a and b) are concatenated together (to ab), and thats almost what i want
But now i want to concatenate them by inserting a hyphen (-) in between (to a – b)
I’ve tried this, but that doesn’t work:
$(this).parents("tr:first").children("td").children("span").join(" - ");
Use $.map: