jquery appending directly after each closing tag before any unwrapped text -


i having trouble getting image link appear directly after closing tag each players names

here snippet of script

if (shouldaddpopupicon()) {     var bodyid = $('body').attr('id');      if (bodyid === 'body_options_02') {         $.each($('a[class^="position_"], td.cbsplayername ,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) { }             });         });     } } 

}

here html before script runs

<p>franchise 1 helped out point effort  <a href="#" class="position_wr">player name 1</a> ,  snuck past new orleans saints defense 44 receiving yards , 1 receiving td.  got point effort  <a href="#" class="position_pk">player name 2</a> ,  beat   defense  field goals made. </p> 

and here afterwards, you'll notice script placing new linked img after of text

    <p>franchise 1 helped out point effort      <a href="#" class="position_wr">player name 1</a>     ,  snuck past new orleans saints defense 44 receiving yards , 1 receiving td.  got point effort      <a href="#" class="position_pk">player name 2</a>     ,  beat   defense  field goals made. <a title="news" href="#"><img class="playerpopupnewsicon" alt="news" src="#"></a> <a title="news" href="#"><img class="playerpopupnewsicon" alt="news" src="#"></a>     </p> 

i new image link placed directly after each a.position closing tag, , before unwrapped text. have no access html better mark up. want this

<p>franchise 1 helped out point effort  <a href="#" class="position_wr">player name 1</a><a title="news" href="#"><img class="playerpopupnewsicon" alt="news" src="#"></a> ,  snuck past new orleans saints defense 44 receiving yards , 1 receiving td.  got point effort  <a href="#" class="position_pk">player name 2</a><a title="news" href="#"><img class="playerpopupnewsicon" alt="news" src="#"></a> ,  beat   defense  field goals made. </p> 


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -