javascript - Loop through a table's td's and check content on inner spans then change the color of the text -
how loop through table , check spans class of code , if contain failed send invite color text failed send invite red?
<table> <tr height="20" class="oddlistrows1"> <td valign="top" class="" scope="row"><span sugar="slot73b" class="code"> <input type="checkbox" onclick="" value="28f6634e-b7bd-3654-7cc5-516bdddb573a" id="contactscheckbox_display_id[]" class="checkbox" name="contactscheckbox_display[]"></span></td> <td valign="top" class="" scope="row"><span sugar="slot74b" class="code"><a href="?action=ajaxui#ajaxuiloc=index.php%3fmodule%3dcontacts%26action%3ddetailview%26record%3d28f6634e-b7bd-3654-7cc5-516bdddb573a">gabriel litchfield</a></span></td> <td valign="top" class="" scope="row"><span sugar="slot75b" class="code"><a href="?action=ajaxui#ajaxuiloc=index.php%3fmodule%3daccounts%26action%3ddetailview%26record%3d95678448-0ddd-eb6e-2fc1-516bdc8f7eff">p piper & sons</a></span></td> <td valign="top" class="" scope="row"><span sugar="slot76b" class="code">(166) 682-8040</span></td> <td valign="top" class="" scope="row"><span sugar="slot77b" class="code"><a onclick="sugar.quickcompose.init({"fullcomposeurl":"load_id=28f6634e-b7bd-3654-7cc5-516bdddb573a\u0026load_module=delegates\u0026parent_type=delegates\u0026parent_id=28f6634e-b7bd-3654-7cc5-516bdddb573a\u0026return_module=fp_events\u0026return_action=detailview\u0026return_id=8dd846fd-e6d3-f6ae-a155-51b700a61700\u0026parent_name=gabriel+litchfield\u0026to_email_addrs=gabriel+litchfield+%3chr.beans%40example.us%3e","composepackage":{"load_id":"28f6634e-b7bd-3654-7cc5-516bdddb573a","load_module":"delegates","parent_type":"delegates","parent_id":"28f6634e-b7bd-3654-7cc5-516bdddb573a","return_module":"fp_events","return_action":"detailview","return_id":"8dd846fd-e6d3-f6ae-a155-51b700a61700","parent_name":"gabriel litchfield","to_email_addrs":"gabriel litchfield \u003chr.beans@example.us\u003e"}});" href="javascript:void(0);">hr.beans@example.us</a></span></td> <td valign="top" class="" scope="row"><span sugar="slot78b" class="code">invited has been sent</span></td> <td valign="top" class="" scope="row"><span sugar="slot79b" class="code">no responce</span></td> <td valign="top" class="inlinebuttons" scope="row"><span sugar="slot80b" class="code"><ul name="" class="clickmenu subpanel records fancymenu button sugaractionmenu" id="ab583b12-7612-20a0-6ef1-51e92fffd078"><li class="sugar_action_button"><div id="ab583b12-7612-20a0-6ef1-51e92fffd078" style="display: inline"><a id="delegates_edit_9" class="listviewtdtoolss1" onfocus="javascript:subp_nav('contacts', '28f6634e-b7bd-3654-7cc5-516bdddb573a', 'e', this, 'fp_events_contacts');" onmouseover="javascript:subp_nav('contacts', '28f6634e-b7bd-3654-7cc5-516bdddb573a', 'e', this, 'fp_events_contacts');" href="#">edit</a></div><ul class="subnav" id=""><li><a onclick="return sp_rem_conf();" id="delegates_remove_9" class="listviewtdtoolss1" href="javascript:sub_p_rem('delegates', 'fp_events_contacts', '28f6634e-b7bd-3654-7cc5-516bdddb573a', 0);">remove</a></li></ul><span class="ab"></span></li></ul></span></td> </tr> <tr height="20" class="oddlistrows1"> <td valign="top" class="" scope="row"><span sugar="slot73b" class="code"> <input type="checkbox" onclick="" value="28f6634e-b7bd-3654-7cc5-516bdddb573a" id="contactscheckbox_display_id[]" class="checkbox" name="contactscheckbox_display[]"></span></td> <td valign="top" class="" scope="row"><span sugar="slot74b" class="code"><a href="?action=ajaxui#ajaxuiloc=index.php%3fmodule%3dcontacts%26action%3ddetailview%26record%3d28f6634e-b7bd-3654-7cc5-516bdddb573a">gabriel litchfield</a></span></td> <td valign="top" class="" scope="row"><span sugar="slot75b" class="code"><a href="?action=ajaxui#ajaxuiloc=index.php%3fmodule%3daccounts%26action%3ddetailview%26record%3d95678448-0ddd-eb6e-2fc1-516bdc8f7eff">p piper & sons</a></span></td> <td valign="top" class="" scope="row"><span sugar="slot76b" class="code">(166) 682-8040</span></td> <td valign="top" class="" scope="row"><span sugar="slot77b" class="code"><a onclick="sugar.quickcompose.init({"fullcomposeurl":"load_id=28f6634e-b7bd-3654-7cc5-516bdddb573a\u0026load_module=delegates\u0026parent_type=delegates\u0026parent_id=28f6634e-b7bd-3654-7cc5-516bdddb573a\u0026return_module=fp_events\u0026return_action=detailview\u0026return_id=8dd846fd-e6d3-f6ae-a155-51b700a61700\u0026parent_name=gabriel+litchfield\u0026to_email_addrs=gabriel+litchfield+%3chr.beans%40example.us%3e","composepackage":{"load_id":"28f6634e-b7bd-3654-7cc5-516bdddb573a","load_module":"delegates","parent_type":"delegates","parent_id":"28f6634e-b7bd-3654-7cc5-516bdddb573a","return_module":"fp_events","return_action":"detailview","return_id":"8dd846fd-e6d3-f6ae-a155-51b700a61700","parent_name":"gabriel litchfield","to_email_addrs":"gabriel litchfield \u003chr.beans@example.us\u003e"}});" href="javascript:void(0);">hr.beans@example.us</a></span></td> <td valign="top" class="" scope="row"><span sugar="slot78b" class="code">invited has been sent</span></td> <td valign="top" class="" scope="row"><span sugar="slot79b" class="code">no responce</span></td> <td class="" valign="top" scope="row"> <span class="code" sugar="slot51b"> invited has been sent</span> </td> <td valign="top" class="inlinebuttons" scope="row"><span sugar="slot80b" class="code"><ul name="" class="clickmenu subpanel records fancymenu button sugaractionmenu" id="ab583b12-7612-20a0-6ef1-51e92fffd078"><li class="sugar_action_button"><div id="ab583b12-7612-20a0-6ef1-51e92fffd078" style="display: inline"><a id="delegates_edit_9" class="listviewtdtoolss1" onfocus="javascript:subp_nav('contacts', '28f6634e-b7bd-3654-7cc5-516bdddb573a', 'e', this, 'fp_events_contacts');" onmouseover="javascript:subp_nav('contacts', '28f6634e-b7bd-3654-7cc5-516bdddb573a', 'e', this, 'fp_events_contacts');" href="#">edit</a></div><ul class="subnav" id=""><li><a onclick="return sp_rem_conf();" id="delegates_remove_9" class="listviewtdtoolss1" href="javascript:sub_p_rem('delegates', 'fp_events_contacts', '28f6634e-b7bd-3654-7cc5-516bdddb573a', 0);">remove</a></li></ul><span class="ab"></span></li></ul></span></td> </tr>
you can try :
$('table span.code').each( function() { if( /(failed send invite)/.test($(this).html() ) ) { $(this).css('color', 'red') } })
Comments
Post a Comment