locked
Hide text using jQuery RRS feed

  • Question

  • User-73514677 posted

    Hi,

    I have a text "Is Document(s) uploaded" . I want to hide this column using jquery. There is no ID field.

    The column is defined as below:

    <td width="110" class="ms-formlabel">
    <h3 class="ms-standardheader">
    <nobr>
    Is Document(s) uploaded

    All the labels have the same definition, so I want to find "Is Document(s) uploaded" and then hide.

    How to achieve this using jQuery?

    Thanks

    Tuesday, July 19, 2016 10:12 AM

Answers

  • User-638331144 posted

    Place this inside your script tag

    $(document).ready(function () {
    	$('table tr td.ms-formlabel h3.ms-standardheader nobr:contains("Is Document(s) uploaded")').hide();
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 20, 2016 1:52 AM
  • User61956409 posted

    Hi venkatzeus,

    I have a text "Is Document(s) uploaded" . I want to hide this column using jquery.

    You could try the following code to hide the row cell.

    $("table tr td").each(function () {
        var txt = $(this).find("h3 nobr").text().trim();
        if (txt == "Is Document(s) uploaded") {
            $(this).hide();
        }
    })
    

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 20, 2016 2:57 AM
  • User-638331144 posted
    $("table tr td.ms-formlabel h3.ms-standardheader nobr:contains('" + searchString  + "')").each(function() {
          $(this).closest("tr").hide();  
    });

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 20, 2016 6:11 AM

All replies

  • User-73514677 posted

    Hi,

    I tried this, but not working:

    $('tr').contents().filter(function(){
          return this.nodeValue.match(/^Is Document(s) uploaded$/i);
    }).closest('tr').hide();
    

    How to hide a specific tr which contains a td having text as "Is Document(s) uploaded".

    Thanks

    Tuesday, July 19, 2016 12:45 PM
  • User-73514677 posted

    Hi,

    I want to hide a specific "TR" having the above text.

    Tuesday, July 19, 2016 1:58 PM
  • User-638331144 posted
    <table name="tableName">
     <tr name="trName">
    ...
    ...
    
    $("tr[name=trName]:contains('Is Document(s) uploaded')").hide()

    just try this. hope it will work as i can't see your html structure.

    Tuesday, July 19, 2016 2:01 PM
  • User-73514677 posted

    HI,

    Thanks for the reply.

    The tr does not have a name field.

    Thanks

    Tuesday, July 19, 2016 2:10 PM
  • User475983607 posted

    How to achieve this using jQuery?

    I would wrap the the content "Is Document(s) uploaded" in a span tag and assign a class to the span.  At that point selecting the span is trivial with a JQuery class selector.  

    Tuesday, July 19, 2016 2:30 PM
  • User-73514677 posted

    HI,

    Thanks for the reply.

    This is in a SharePoint list. The only css which i see in developer tools is this:

    <td width="110" class="ms-formlabel">
    <h3 class="ms-standardheader">
    <nobr>
    Is Document(s) uploaded

    Thanks

    Tuesday, July 19, 2016 3:04 PM
  • User475983607 posted

    HI,

    Thanks for the reply.

    This is in a SharePoint list. The only css which i see in developer tools is this:

    <td width="110" class="ms-formlabel">
    <h3 class="ms-standardheader">
    <nobr>
    Is Document(s) uploaded

    Thanks

    This question is very difficult to answer because you only show a very small part of the overall DOM.  You can give this a try but I can't make any promises.  

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
        <script type="text/javascript">
            $(function () {
                $('table tr td.ms-formlabel h3.ms-standardheader nobr:contains("Is Document(s) uploaded")').wrapInner('<span class="isDocUpload"></span>');
                $('#Button1').click(function () {
                    $('.isDocUpload').toggle();
                });
            });
        </script>
    </head>
    <body>
        <div>
            <table>
                <tr>
                    <td width="110" class="ms-formlabel">
                        <h3 class="ms-standardheader">
                            <nobr>
                                Is Document(s) uploaded
                            </nobr>
                        </h3>
                    </td>
                </tr>
            </table>
            <input id="Button1" type="button" value="button" />
        </div>
    </body>
    </html>
    

    Tuesday, July 19, 2016 5:25 PM
  • User-638331144 posted

    Place this inside your script tag

    $(document).ready(function () {
    	$('table tr td.ms-formlabel h3.ms-standardheader nobr:contains("Is Document(s) uploaded")').hide();
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 20, 2016 1:52 AM
  • User61956409 posted

    Hi venkatzeus,

    I have a text "Is Document(s) uploaded" . I want to hide this column using jquery.

    You could try the following code to hide the row cell.

    $("table tr td").each(function () {
        var txt = $(this).find("h3 nobr").text().trim();
        if (txt == "Is Document(s) uploaded") {
            $(this).hide();
        }
    })
    

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 20, 2016 2:57 AM
  • User-73514677 posted

    Hi,

    Thanks for the reply.

    The below code is working:

    $(document).ready(function () {
    	$('table tr td.ms-formlabel h3.ms-standardheader nobr:contains("Is Document(s) uploaded")').hide();
    }

    Is it possible to hide that "tr" itself?

    I tried this:

    var searchString = "Is Document(s) uploaded";
    $("table tr td.ms-formlabel h3.ms-standardheader nobr:contains('" + searchString  + "')").each(function() {
        if ($(this).text() == searchString) {
            $(this).parent().css("display","none");
        }  
    });
    

    But the "Tr" is not getting hidden.

    Thanks

    Wednesday, July 20, 2016 4:24 AM
  • User-638331144 posted
    $("table tr td.ms-formlabel h3.ms-standardheader nobr:contains('" + searchString  + "')").each(function() {
          $(this).closest("tr").hide();  
    });

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 20, 2016 6:11 AM
  • User-73514677 posted

    Hi,

    Thanks a lot.. That worked

    Wednesday, July 20, 2016 6:38 AM