title: jquery appending directly after each closing tag before any unwrapped text
body: <p>I am having trouble getting my image link to appear directly after the closing a tag for each players names</p>
  
  <p>Here is a snippet of the script </p>
  
  <pre><code>if (shouldAddPopupIcon()) {
      var bodyId = $('body').attr('id');
  
      if (bodyId === 'body_options_02') {
          $.each($('a[class^="position_"], td.cbsPlayerName a ,td.playertd a'), function (index, value) {
              var id = getPlayerIdFromHref($(this).attr('href'));
              _playerPopupIds.push(id);
          });
  
          _playerPopupIds = getUniqueArray(_playerPopupIds);
  
          $.ajax({
              type: 'GET',
              url: getPlayerProfileApiUrl()
          }).done(function (data) {
  
              $.each($('a[class^="position_"], td.cbsPlayerName a, td.playertd a'), function (index, value) {
                  try {
                      if(!$(this).nextAll('a').hasClass('playerPopupNewsIcon'))
                          {                               
                              var id = getPlayerIdFromHref($(this).attr('href'));
  
                              var profile = $.grep(data.playerProfiles.playerProfile, function (p) {
                                  return p.id === id;
                              })[0];
  
                              var newsIcon = getNewsIconType(profile);
                              var playerName = $(this).text();
                              var link = getPlayerPopupLink(id, playerName, newsIcon);
  
                              $(this).parent().append(link);
  
                              if (_settings.playerClickShowsPopup) 
                              {
                                  $(this).unbind().click(function () 
                                  {
                                      renderPopup(id, playerName);
                                      return false;
                                  });
                              }
                          }
                      } 
                  catch (err) { }
              });
          });
      } else {
          $.each($('td.player'), function (index, value) {
              var id = getPlayerIdFromHref($(this).children().first().attr('href'));
              _playerPopupIds.push(id);
          });
  
          _playerPopupIds = getUniqueArray(_playerPopupIds);
  
          $.ajax({
              type: 'GET',
              url: getPlayerProfileApiUrl()
          }).done(function (data) {
              $.each($('td.player'), function (index, value) {
                  try {
                      var id = getPlayerIdFromHref($(this).children().first().attr('href'));
  
                      var profile = $.grep(data.playerProfiles.playerProfile, function (p) {
                          return p.id === id;
                      })[0];
  
                      var newsIcon = getNewsIconType(profile);
                      var playerName = $(this).children().first().text();
                      var link = getPlayerPopupLink(id, playerName, newsIcon);
  
                      $(this).append(link);
  
                      if (_settings.playerClickShowsPopup) {
                          $(this).unbind().click(function () {
                              renderPopup(id, playerName);
                              return false;
                          });
                      }
                  } catch (err) { }
              });
          });
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is the HTML before the script runs</p>
  
  <pre><code>&lt;p&gt;Franchise 1 were helped out by a point effort from 
  &lt;a href="#" class="position_wr"&gt;PLAYER NAME 1&lt;/a&gt;
  , who  snuck past the New Orleans Saints defense for 44 receiving yards and 1 receiving TD.  They also got help from a point effort from 
  &lt;a href="#" class="position_pk"&gt;PLAYER NAME 2&lt;/a&gt;
  , who  beat the   defense for  field goals made.
  &lt;/p&gt;
  </code></pre>
  
  <p>And here it is afterwards, You'll notice the script is placing the new linked img after all of the text</p>
  
  <pre><code>    &lt;p&gt;Franchise 1 were helped out by a point effort from 
      &lt;a href="#" class="position_wr"&gt;PLAYER NAME 1&lt;/a&gt;
      , who  snuck past the New Orleans Saints defense for 44 receiving yards and 1 receiving TD.  They also got help from a point effort from 
      &lt;a href="#" class="position_pk"&gt;PLAYER NAME 2&lt;/a&gt;
      , who  beat the   defense for  field goals made.
  &lt;a title="news" href="#"&gt;&lt;img class="playerPopupNewsIcon" alt="news" src="#"&gt;&lt;/a&gt;
  &lt;a title="news" href="#"&gt;&lt;img class="playerPopupNewsIcon" alt="news" src="#"&gt;&lt;/a&gt;
      &lt;/p&gt;
  </code></pre>
  
  <p><strong>I would like the new image link to be placed directly after each a.position closing tag, and before the unwrapped text. I have no access to the HTML to better mark this up.
  Want to look like this</strong></p>
  
  <pre><code>&lt;p&gt;Franchise 1 were helped out by a point effort from 
  &lt;a href="#" class="position_wr"&gt;PLAYER NAME 1&lt;/a&gt;&lt;a title="news" href="#"&gt;&lt;img class="playerPopupNewsIcon" alt="news" src="#"&gt;&lt;/a&gt;
  , who  snuck past the New Orleans Saints defense for 44 receiving yards and 1 receiving TD.  They also got help from a point effort from 
  &lt;a href="#" class="position_pk"&gt;PLAYER NAME 2&lt;/a&gt;&lt;a title="news" href="#"&gt;&lt;img class="playerPopupNewsIcon" alt="news" src="#"&gt;&lt;/a&gt;
  , who  beat the   defense for  field goals made.
  &lt;/p&gt;
  </code></pre>