Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7559489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:39:06+00:00 2026-05-30T12:39:06+00:00

I have two Jquery functions that each work independently on a sharepoint page –

  • 0

I have two Jquery functions that each work independently on a sharepoint page – however I’d like for them to work together – both ‘if’ statements must be statisfied in order for an action to take place e.g. IF the right list name is found AND the right item is in that list THEN hide that row.

$(".ms-WPHeader").each(function(){

var valx = $(this).text();

    if(valx=="ListName"){
        alert("found");
    }
});


$(".ms-vb-title").each(function(){

var val = $(this).text();

    if(val=="this item"){
        $(this).parents('tr:first').hide();

    }
});

I’ve new to Jquery and still new to the structure – I’ve searched everywhere – hope you can help?

Additional code snippet shows relationship between WPHeader and vb-title:

<td id="MSOZoneCell_WebPartWPQ2" valign="top">
<table width="100%" cellspacing="0" cellpadding="0" border="0" toplevel="">
<tbody>
<tr>
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr class="ms-WPHeader">
<td id="WebPartTitleWPQ2" style="width:100%;" title="ListName">
<h3 class="ms-standardheader ms-WPTitle">
<a href="/test/Lists/Content%20List/AllItems.aspx" tabindex="0" accesskey="W">
<nobr>
<span>ListName</span>
<span id="WebPartCaptionWPQ2"></span>
</nobr>
</a>
</h3>
</td>
<td valign="middle" style="width:10px;padding-right:2px;">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="" valign="top">
<div id="WebPartWPQ2" style="" allowexport="false" allowdelete="false" width="100%" haspers="false" webpartid="9cc3ce88-c0c6-40d4-84a6-0a14d4bfe3ed">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<script>
<tbody>
<tr>
<td>
<iframeid="FilterIframe1" width="0" height="0" filterlink="http://dab:23292/test/Content%20Library/Template%20page.aspx?Filter=1&View=%7b9CC3CE88%2dC0C6%2d40D4%2d84A6%2d0A14D4BFE3ED%7d" title="Hidden frame to filter list" style="display:none" name="FilterIframe1" src="javascript:false;">
<table id="{33B3ECBF-66DA-41AD-811D-F3A2D7F644F7}-{9CC3CE88-C0C6-40D4-84A6-0A14D4BFE3ED}" class="ms-listviewtable" width="100%" cellspacing="0" cellpadding="1" border="0" dir="None" o:webquerysourcehref="http://dab:23292/test/_vti_bin/owssvr.dll?CS=65001&XMLDATA=1&RowLimit=0&List={33B3ECBF-66DA-41AD-811D-F3A2D7F644F7}&View={9CC3CE88-C0C6-40D4-84A6-0A14D4BFE3ED}" summary="Content Meta List">
<tbody>
<tr class="ms-viewheadertr" valign="TOP" style="display: none;">
<tr class="">
<tr class="ms-alternating">
<td class="ms-vb2">
<td class="ms-vb2">
<td class="ms-vb-title" height="100%">
<table id="7" class="ms-unselectedtitle" height="100%" cellspacing="0" surl="" uis="512" cid="0x0100363A3EFC8C275E49B25A04F063C9FADB" ctype="Item" ms="0" csrc="" hcd="" couid="" otype="0" icon="icgen_gif||" ext="" type="" perm="0x7fffffffffffffff" dref="test/Lists/Content List" url="/test/Lists/Content%20List/7_.000" ctxname="ctx1" onmouseover="OnItem(this)">
<tbody>
<tr>
<td class="ms-vb" width="100%">
<a target="_self" onclick="GoToLink(this);return false;" href="/test/Lists/Content%20List/DispForm.aspx?ID=7" onfocus="OnLink(this)">this item
</a>
</td>
<td class="">
</tr>
</tbody>
</table>
</td>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:39:07+00:00Added an answer on May 30, 2026 at 12:39 pm

    Assuming that ms-vb-title is the class name of list items and ms-WPHeader is inside this list somewhere, here is the proper code:

    $(".ms-vb-title").each(function(){
        var val = $(this).text();
        if(val === "this item" && $(this).parents("ul").find(".ms-WPHeader").text() === "ListName") {
            $(this).parents('tr:first').hide();
        }
    });
    

    If the element with class ms-WPHeader is outside the list but the amount match the amount of lists, you can try with index():

    $(".ms-vb-title").each(function(){
        var val = $(this).text();
        if(val === "this item") {
            var oParentList = $(this).parents("ul");
            var oHeader = $(".ms-WPHeader").eq(oParentList.index());
            if (oHeader.text() === "ListName") {
                $(this).parents('tr:first').hide();
            }
        }
    });
    

    Edit: seeing your actual markup, here is something that should work better:

    $(".ms-vb-title").each(function(){
        var val = $.trim($(this).find("a").text());
        if(val === "this item" && $(".ms-WPHeader").find("td").first().attr("title") === "ListName") {
            $(this).parents('tr:first').hide();
        }
    });
    

    Edit: assuming you got amount of .ms-WPHeader equal to .ms-vb-title and in same order, you can use the index:

    $(".ms-vb-title").each(function(index){
        var val = $.trim($(this).find("a").text());
        if(val === "this item" && $(".ms-WPHeader").eq(index).find("td").first().attr("title") === "ListName") {
            $(this).parents('tr:first').hide();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have two jquery functions that bassically do the same, but on 2
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
I have two select lists, I would like jquery to either remove or disable
I have two scripts running on the same page, one is the jQuery.hSlides.js script
I'd like to check ancestry using two jQuery objects. They don't have IDs, and
I have two ajax functions that fetch JSON objects using .getJSON and then build
I have two divs that have 50% width each. I want to make it
It seems that when using two jquery UI droppables that touch each other, the
I have two JavaScript functions that I want to call from inside of a
I have two separate (but similar) bits of jQuery code. They both work, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.