vendredi 29 mai 2015

How to hide a table row which have TD containing certain values

I am working on a SharePoint web site , and I need using CSS (Preferred) or JavaScript, to hide a table row that have two main TDs:-

  1. TD with a text named Item Number.
  2. TD with an input titled Item number.

Here is how the mark-up is constructed:-

enter image description here

Can anyone advice on this please?

i tried the following script , but did not hide the Item Number or the customer initial , baring in mind that all the TR are inside a table which have .ms-formtable class:-

    <script>
$(function() {

  $('.ms-formtable tr').each(function() {
    var frstVal = $(this).find('td').eq(0).text();
    if (frstVal.match(/Item Number|customer Initials/i)) {
      $(frstVal).remove()
    }
  });

});

    </script>

here is the related markup :-

<table width="100%" class="ms-formtable" style="margin-top: 8px;" border="0" cellspacing="0" cellpadding="0">
<tbody>

<td width="113" class="ms-formlabel" nowrap="true" valign="top">
<h3 class="ms-standardheader">

<nobr>Item Number</nobr>

</h3></td>


<td width="350" class="ms-formbody" valign="top">

<span dir="none"><input title="Item Number" class="ms-long ms-spellcheck-true" id="_x0049_D1_806a702b-1716-47f5-a93c-16067f502daf_$TextField" type="text" maxlength="255" value=""><br></span>

<span class="ms-metadata">Do not customize at the list level</span>


</td>

Aucun commentaire:

Enregistrer un commentaire