none
Escaping parenthesis in JQuery RRS feed

  • Question

  • Hi

    I am trying to hide this column but its not getting hidden due to may be some paranthesis and comma

    $('nobr:contains("Approx amount(in kg) of substance with long term effects(ABC,DEFsingle exposure)XYZ Cat. 3.5 to 3.8(GHS Hazard Statements H340,H350,H360,H370) ABCD>=100 kg, ABCD>=5 kg")').closest('tr').hide();

    Thanks in advance


    Paru

    Thursday, May 3, 2018 8:40 AM

Answers

  • Hi,

    Try with unique text to filter the nobr element, you could check my test code below.

    $("nobr:contains('DEFsingle')").css("background-color", "yellow");

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by Paru Upreti Monday, May 7, 2018 4:14 PM
    Monday, May 7, 2018 1:08 AM

All replies

  • Hi,

    For SharePoint column, we could hide it based on attribute selector usually.

    Sample:

    A text filed(Name).


    Hide parent TR by attribute selector.

    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
        <script type="text/javascript">
            $(function () {
                $('input[title="Name"]').closest('tr').hide();
            })
        </script>

    Result.

    jQuery selectors.

    https://www.w3schools.com/jquery/jquery_ref_selectors.asp

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Friday, May 4, 2018 1:40 AM
  • Thanks Lee

    But my column is like below and i cannot access the tr


    Paru

    Friday, May 4, 2018 10:46 AM
  • Hi,

    Try with unique text to filter the nobr element, you could check my test code below.

    $("nobr:contains('DEFsingle')").css("background-color", "yellow");

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by Paru Upreti Monday, May 7, 2018 4:14 PM
    Monday, May 7, 2018 1:08 AM
  • Thanks Lee, this works :)

    Paru

    Monday, May 7, 2018 4:14 PM
  • Hi Lee

    Can we also reset the value of the field while hiding it?

    Thanks in advance


    Paru

    Tuesday, May 8, 2018 1:55 PM
  • Hi,

    I’m not so clear about what you’re trying to do.

    While you could set nobr text by jQuery .html(‘text’).

    Sample code:

    var originText = $("nobr:contains('DEFsingle')").html();
                alert(originText);
                $("nobr:contains('DEFsingle')").html('update text');

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, May 9, 2018 12:55 AM