jquery get url from div and insert it into span -
i url <div class="ms-vb itx">
, replace href within span below. doable in jquery? make sense?
<td height="100%" class="ms-vb-title ms-vb-lastcell" onmouseover="onchilditem(this)"> <div eventtype="" perm="0x7fffffffffffffff" field="linktitle" id="5" ctxname="ctx6" onmouseover="onitem(this)" class="ms-vb itx"> <a target="_self" onclick="editlink2(this,6);return false;" href="/_layouts/rf.portal.web/detailactualite.aspx?4&listid={5b770e71-5269-4f45-87a0-2defa1136e40}&id=5&contenttypeid=0x0100fbea8b5f8e1448f4b48c33a18522e2da01001677ea3c9b9802408d15440e3b1906de" onfocus="onlink(this)">icitait l'honneur d'être reçu,</a> <img class="ms-newgif" title="nouveau" alt="nouveau" src="/_layouts/1036/images/new.gif"> </div> <div onmouseover="onchilditem(this.parentnode); return false;" class="s4-ctx" style="top: 52px; left: 1015px; height: 105px; line-height: 105px; margin: 0px;"> <span> </span> <a title="menu ouvrir" href="javascript:;" onclick="popmenufromchevron(event); return false;" onfocus="onchilditem(this.parentnode.parentnode); return false;"> <img style="visibility: hidden;" src="/_layouts/images/ecbarw.png" alt="menu ouvrir"></a> <span> </span> </div> <span style="color: rgb(128, 128, 128);"><em> publié le 07/03/2011 11:30 - en cours</em></span><br> et ayant nom athos, porthos et aramis. nous l'avouons, ces trois noms étrange<br><br> <span style="font-size: 0.9em; color: rgb(128, 128, 128);" id="lirearticle"> <a class="rfr-link-action" href="dispform.aspx?id=5">lire l'article</a> <br><br></span> </td>
sure, have make sure select right elements.
e.g.:
var $div = $('div.ms-vb.itx'); $div.next('span').find('a').attr('href', $div.find('a').attr('href'));
if have more elements these classes , want perform every of them, can use each()
:
$('div.ms-vb.itx').each(function() { $(this).next('span').find('a').attr('href', $(this).find('a').attr('href')); });
update:
ok, assume have several of these div
s inside table , want of them.
the a
element want change seems have class rfr-link-action
, can make use of this. note, although span
element has id, ids have unique in document. no 2 elements can have same id.
$('div.ms-vb.itx').each(function() { $(this).closest('td') // gets reference table cell .find('a.rfr-link-action') // finds link .attr('href', $(this).find('a').attr('href')); // sets url });
Comments
Post a Comment