Wrap Last Element in Array

Wrap Last Element in Array

I have the following markup:
  1. <h2 class="pagetitle">Key Staff Profiles</h2>
I want to select the last bit of text, in this case "Profiles," and wrap it with a span. I have the following code.

  1. var title = $(".pagetitle").text().split(" ");
    var lastEl = title[title.length-1];
    $(lastEl).wrap("<span />");

The first two lines do what I want, but I can't the wrap to work. What am I doing wrong? Thanks