jquery - Remove the unwanted text through javascript -
i have table cannot access html code. want remove 'information' , '|' coming before "registration" link. want registration link in <td>
. trying do.
<script> j$(document).ready(function() { j$('td.table-text:contains("|")').replacewith(" "); }); </script> </head> <table width="100%" cellspacing="0" cellpadding="0" id="registrants" class="grid"> <tbody> <tr class=""> <td class="table-text"> <input type="checkbox" onclick="autocheckguest('ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_chkregistrant', 'registrants', 'ctl00_contentplaceholder1_ctl01_traddanother', 'true');" name="ctl00$contentplaceholder1$ctl01$rptregistrants$ctl00$chkregistrant" id="ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_chkregistrant" class=""> <input type="hidden" value="75a6c1cd-39bc-4cfd-b220-5a8b2bba1ff9" id="ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_hdnregistrant" name="ctl00$contentplaceholder1$ctl01$rptregistrants$ctl00$hdnregistrant"> <input type="hidden" value="3" id="ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_hdnentitytype" name="ctl00$contentplaceholder1$ctl01$rptregistrants$ctl00$hdnentitytype"> </td> <td class="table-text">test name <label class="bodytextbold1" id="ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_lblprimaryinvitee" for="ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_chkregistrant">(primary registrant)</label> </td> <td class="table-text" id="ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_tdregistrationtype">group leader </td> <td class="table-text"><a href="javascript:webform_dopostbackwithoptions(new webform_postbackoptions("ctl00$contentplaceholder1$ctl01$rptregistrants$ctl00$btnmodifypersonalinfo", "", true, "", "", false, true))" id="ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_btnmodifypersonalinfo" onclick="javascript:return validateunregistercheckbox('ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_chkregistrant','you cannot modify information guest unregistered.');">information</a> | <a href="javascript:webform_dopostbackwithoptions(new webform_postbackoptions("ctl00$contentplaceholder1$ctl01$rptregistrants$ctl00$btnmodifyreginfo", "", true, "", "", false, true))" id="ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_btnmodifyreginfo" onclick="javascript:return validateunregistercheckbox('ctl00_contentplaceholder1_ctl01_rptregistrants_ctl00_chkregistrant','you cannot modify information guest unregistered.');">registration</a> </td> </tr> </tbody> </table>
you can traverse find last a
element in last td
, replace contents. try this:
var $td = $('td').last(); var $a = $td.find('a').last(); $td.empty().append($a);
if need achieve on multiple rows of table, can instead use :last-child
selector:
var $tds = $('tr td:last-child'); var $a = $tds.find('a').last(); $td.empty().append($a);
Comments
Post a Comment