• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 744
  • Last Modified:

css jquery hide tr

I can't get jquery to select my TR and make it disappear, or even put a border around it.

Here is the tr I am trying to get a handle on:
<tr id="ctl00_PlaceHolderMain_ifsSendEmail">
                  <td valign="top" class="ms-descriptiontext">


This doesn't work:
$("tr#ctl00_PlaceHolderMain_ifsSendEmail")
0
jackjohnson44
Asked:
jackjohnson44
  • 7
  • 4
  • 2
  • +2
1 Solution
 
Scott Fell, EE MVEDeveloperCommented:
To hide the row this is a working sample http://jsbin.com/ezugok/1/edit of the code below

$(document).ready(function() {
 $('tr#ctl00_PlaceHolderMain_ifsSendEmail').hide();
});

Open in new window

0
 
jackjohnson44Author Commented:
Thanks.

Sorry, I didn't phrase that well.  For some reason, the selector that you and I tried will not select the TR.   The code you posted will not work.  I am testing using firebug.

It looks to me that it should work, but it just won't.  If I do
$('tr#ctl00_PlaceHolderMain_ifsSendEmail').size(), I get 0
0
 
Scott Fell, EE MVEDeveloperCommented:
If you click on the link I sent you it works perfectly.  If it does not work with your page, then you have an error some place on your page.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jackjohnson44Author Commented:
This is also in a SharePoint popup, but I didn't think that would be an issue.
0
 
jackjohnson44Author Commented:
Thanks, that is why I am asking.
0
 
Ersoy HasanCommented:
You could be creating the row after document.ready and that could be the reason you have 0 length after selection. You could use just css to do the same that way it will be always hidden and you will show the row only if you need it.

#ctl00_PlaceHolderMain_ifsSendEmail {
    display:none
}

Open in new window

0
 
Scott Fell, EE MVEDeveloperCommented:
Let's focus on the question you asked.

>I can't get jquery to select my TR and make it disappear

You will use the .hide() command.  In this case to target your given id it is

$('tr#ctl00_PlaceHolderMain_ifsSendEmail').hide();
0
 
jackjohnson44Author Commented:
Why would I focus on statement that I made when I misspoke then admitted to?  I'd like to move on.   Please do not respond to this again. I am not looking for an argument.  I apologize for wasting your time.
0
 
LZ1Commented:
Do you have a live URL?
0
 
jackjohnson44Author Commented:
Unfortunately no.  If you have access to SharePoint and can open the dialogue to grant user permissions, I am trying to remove the area with a checkbox saying send welcome email to new user.
0
 
LZ1Commented:
Unfortunately I don't have access to a SharePoint site. My guess though would be that there maybe some other js that is either overriding or nullifying your jQuery.
0
 
jackjohnson44Author Commented:
I believe that the issue is the dialogue is inside an iframe.  I don't have any control over how this appears or works.
0
 
Rainer JeschorCommented:
Hi,
as I assume you refer to your other question with the send email area, can you ensure that jQuery is loaded correctly?
I did the following:
In the PlaceHolderAdditionalPageHead add a reference to your jQuery library. Then add a Javascript block with a function:
function HideEmailRow() {
jQuery("tr#ctl00_PlaceHolderMain_ifsSendEmail").hide(); 
}

Open in new window

Then search for the function
_spBodyOnLoad()
and add a call to your created function:
HideEmailRow();

This works on my dev server.
HTH
Rainer
0
 
Scott Fell, EE MVEDeveloperCommented:
I'm not arguing. Please don't be offended. In order for us to help you, you can see it is important to get all the facts out as we can't read your mind.     I would suggest closing out this question and create a new one building on what you know.
0
 
Rainer JeschorCommented:
And here the complete content of
AclInv.aspx
<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ Page Language="C#" DynamicMasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.ApplicationPages.AclInv"       %> <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
<!-- // EE-Added RainerJ -->
<script language="JavaScript" type="text/javascript" src="/_layouts/RainerJScripts/jquery-1.9.1.min.js"></script>
<script language="JavaScript" type="text/javascript">
function HideEmailRow()
{
	jQuery("tr#ctl00_PlaceHolderMain_ifsSendEmail").hide();
}
</script>

<SCRIPT language="JavaScript">
function ULSF6s(){var o=new Object;o.ULSTeamName="Microsoft SharePoint Foundation";o.ULSFileName="AclInv.aspx";return o;}
var subjectChanged = false;
var rolesCblShown = false;
function UpdateEmailSubject()
{ULSF6s:;
	if(subjectChanged)
		return;
	try
	{
		var objEmailSubject = (document.getElementById("<%= txtEmailSubject.ClientID %>"));
		if (objEmailSubject != null)
		{
			var addToGroup = (document.getElementById("<%= RadAddToGroup.ClientID %>")).checked;
			if (addToGroup)
			{
				var groupCombo = (document.getElementById("<%= DdlGroup.ClientID %>"));
				objEmailSubject.value = AddToGroupEmailSubjectLines[groupCombo.selectedIndex];
			}
			else
			{
				objEmailSubject.value = AddToRoleEmailSubjectLines[0];
			}
		}
	}
	catch(e)
	{
	}
}
function OnSubjectChanged()
{ULSF6s:;
	subjectChanged = true;
}
function _spBodyOnLoad()
{ULSF6s:;
	SetAddToGroupOrRoleStatus();
	// EE-Added RainerJ
	HideEmailRow();
}
function SetAddToGroupOrRoleStatus()
{ULSF6s:;
	var eleGroupInputSection = (document.getElementById("<%= IfsGivePermissions.ClientID %>"));
	if (eleGroupInputSection == null)
		return;
	var addToGroup = (document.getElementById("<%= RadAddToGroup.ClientID %>")).checked;
	var children = document.getElementById("<%= RadAddToGroup.ClientID %>" + "_child");
	if (children != null)
		SetChildControlsDisabledStatus(children , !addToGroup );
	children = document.getElementById("<%= RadAddToRole.ClientID %>" + "_child");
	if (children != null)
		SetChildControlsDisabledStatus(children, addToGroup );
	UpdateRolesCbl();
	UpdateEmailSubject();
}
function UpdateRolesCbl()
{ULSF6s:;
	var rolesDiv = document.getElementById("divRoles");
	var addToRoleChecked = false;
	if (rolesDiv == null)
		return;
	var addToRole = (document.getElementById("<%= RadAddToRole.ClientID %>"));
	if (addToRole != null)
		addToRoleChecked = addToRole.checked;
	else
		return;
	var valCblRolesElement = (document.getElementById("<%= ValCblRoles.ClientID %>"));
	if (addToRoleChecked)
	{
		rolesDiv.style.display= "block";
	}
	else
	{
		rolesDiv.style.display= "none";
		if (valCblRolesElement != null)
		{
			valCblRolesElement.style.visibility = "hidden";
		}
	}
}
function GotoGroupSecScopes(link)
{ULSF6s:;
	var ddlGroup = (document.getElementById("<%= DdlGroup.ClientID %>"));
	if (ddlGroup != null)
	{
		if (ddlGroup.value != "")
		{
			var url = "ViewGroupPermissions.aspx?ID=" + escapeProperly(ddlGroup.value);
			var feature;
			if(window.showModalDialog && !browseris.safari125up)
				feature = "resizable:yes;status:no;scroll:no;help:no;center:yes;dialogWidth:525pt;dialogHeight:400pt;";
			else
				feature = "resizable=yes,status=no,scrollbars=no,menubar=no,directories=no,location=no,width=650,height=500";
			commonShowModalDialog(url, feature);
			return true;
		}
	}
	return false;
}
</SCRIPT>
</asp:Content>
<asp:Content contentplaceholderid="PlaceHolderPageTitle" runat="server">
	<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_pagetitle%>" EncodeMethod='HtmlEncode'/>
</asp:Content>
<asp:content contentplaceholderid="PlaceHolderPageTitleInTitleArea" runat="server">
	<a href="settings.aspx"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,settings_pagetitle%>" EncodeMethod="HtmlEncode"/></a>&#32;<SharePoint:ClusteredDirectionalSeparatorArrow runat="server" /> <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_pagetitle%>" EncodeMethod='HtmlEncode'/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">
<asp:Label id="Label_Aclinv_PageDesc" runat="server" Visible="True"
		Text="<%$Resources:wss,aclinv_pagedescription%>" />
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<table border="0" cellspacing="0" cellpadding="0" class="ms-propertysheet">
	<wssuc:InputFormSection Title="<%$Resources:wss,aclinv_Step1Title%>"
		Description="<%$Resources:wss,aclinv_DescGrantIndiv%>"
		runat="server">
		<Template_Description>
			<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_DescGrantIndiv%>" EncodeMethod='HtmlEncode'/>
			<br/>
			<br/>
		</Template_Description>
		<Template_InputFormControls>
			<wssuc:InputFormControl LabelText="<%$Resources:wss,aclinv_UserGroupsLabel%>" runat="server">
				<Template_Control>
					<wssawc:PeopleEditor
								AllowEmpty=false
								ValidatorEnabled="true"
								id="userPicker"
								runat="server"
								ShowCreateButtonInActiveDirectoryAccountCreationMode=true
								SelectionSet="User,SecGroup,SPGroup"
								/>
				</Template_Control>
			</wssuc:InputFormControl>
		</Template_InputFormControls>
	</wssuc:InputFormSection>
	<wssuc:InputFormSection
		Title="<%$Resources:wss,aclinv_Step2Title1%>"
		Description="<%$Resources:wss,aclinv_DescChoosePerms%>"
		runat="server"
		id = "IfsGivePermissions">
		<Template_InputFormControls>
			<wssuc:InputFormControl runat="server" LabelText="<%$Resources:wss,aclinv_PermsLabel%>">
				<Template_Control>
					<table class="ms-authoringcontrols" border="0" cellpadding="0" cellspacing="0" width="100%">
						<wssawc:InputFormRadioButton runat="server"
							Id="RadAddToGroup"
							LabelText="<%$Resources:wss,aclinv_addusertogroup%>"
							GroupName="AddToGroupOrRole"
							Checked="true"
							onclick="SetAddToGroupOrRoleStatus()"
							>
							<asp:DropDownList
								id="DdlGroup"
								runat="server"
								ToolTip="<%$Resources:wss,aclinv_DdlGroupToolTip%>"
								onchange="UpdateEmailSubject()"/>
							<wssawc:InputFormRequiredFieldValidator runat="server"
								id="ReqValGroup"
								ControlToValidate="DdlGroup"
								EnableClientScript ="false"
								/>
							<wssawc:InputFormCustomValidator runat="server"
								id="CusValGroup"
								ControlToValidate="DdlGroup"
								EnableClientScript ="false"
								OnServerValidate = "CusValGroup_ServerValidate"
								ErrorMessage="<%$Resources:wss,aclinv_cannoteditmembership%>"
								/>
							<asp:PlaceHolder id="PanelViewGroupPerm" runat="server">
							<br/><a id="LnkViewGroupPerm" href="javascript:" onclick="GotoGroupSecScopes(this);return false;"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_viewgroupperm%>" EncodeMethod='HtmlEncode'/></a>
							</asp:PlaceHolder>
						</wssawc:InputFormRadioButton>
						<wssawc:InputFormRadioButton runat="server"
							Id="RadAddToRole"
							LabelText="<%$Resources:wss,aclinv_addusertopermlevel%>"
							GroupName="AddToGroupOrRole"
							onclick="SetAddToGroupOrRoleStatus()"
							>
							<asp:PlaceHolder id="PanelCannotAddUserToRoleInheritedPerm" runat="server" Visible="false">
							<% if (Web.UIVersion > 3) { %>
									<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_inheritperm_msgv4%>" EncodeMethod='HtmlEncode'/>
							<% } else {%>
								<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_inheritperm_msg%>" EncodeMethod='HtmlEncode'/>
							<% } %>
							</asp:PlaceHolder>
							<asp:PlaceHolder id="PanelCannotAddUserToRoleNoPerm" runat="server" Visible="false">
								<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_adduserdirectly_noperm%>" EncodeMethod='HtmlEncode'/>
							</asp:PlaceHolder>
							<div id="divRoles">
							<wssawc:InputFormCheckBoxList
										id="cblRoles"
										runat="server"
										class="ms-authoringcontrols"/>
							<wssawc:InputFormCheckBoxListValidator
										id="ValCblRoles"
										ControlToValidate="cblRoles"
										DisplayMode="Static"
										ErrorMessage="<%$Resources:wss,aclinv_NoPermission_ERR%>"
										runat="server" />
							 </div>
							<asp:PlaceHolder id="PanelPictureLibraryNote" visible="false" runat="server">
								<br/><br/>
								<span class="ms-alerttext"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_PicLibNoteLabel%>" EncodeMethod='HtmlEncode'/></span>
								<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclinv_PicLibNote%>" EncodeMethod='HtmlEncode'/>
							</asp:PlaceHolder>
						</wssawc:InputFormRadioButton>
					</table>
				</Template_Control>
			</wssuc:InputFormControl>
		</Template_InputFormControls>
	</wssuc:InputFormSection>
	<wssuc:InputFormSection
		Title=""
		runat="server"
		id=ifsSendEmail
		visible="False">
		<Template_Description>
			<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclver_DescSendEmail%>" EncodeMethod='HtmlEncode' />
			<br/><br/>
			<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclver_DescSendEmail2%>" EncodeMethod='HtmlEncode' />
		</Template_Description>
		<Template_InputFormControls>
			  <wssawc:InputFormCheckBox
				  runat="server"
				  id="chkSendEmail"
				  Checked="False"
				  Visible="False"
				  LabelText="<%$Resources:wss,aclver_SendEmailCheckbox%>"
				  ToggleChildren=true>
						<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclver_SubjectLabel%>" EncodeMethod='HtmlEncode'/>
						<br/>
						<wssawc:InputFormTextBox title="<%$Resources:wss,aclver_SubjectTitle%>" class="ms-long" ID="txtEmailSubject" Columns="35" Runat="server" MaxLength=512 OnChange="OnSubjectChanged()" />
						<wssawc:InputFormRequiredFieldValidator id="ReqValEmailSubject" runat="server"
							BreakBefore=true BreakAfter=true
							EnableClientScript ="false"
							ControlToValidate="txtEmailSubject"/>
						<br/>
						<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,aclver_BodyLabel%>" EncodeMethod='HtmlEncode'/>
						<br/>
						<wssawc:InputFormTextBox title="<%$Resources:wss,aclver_BodyTitle%>" class="ms-long" ID="txtEmailBody" Runat="server" TextMode="MultiLine" Columns="40" Rows="8" Cols=64 MaxLength=2000 />
			  </wssawc:InputFormCheckBox>
		</Template_InputFormControls>
	</wssuc:InputFormSection>
	<wssuc:ButtonSection runat="server">
		<Template_Buttons>
			<asp:PlaceHolder runat="server">
				<asp:Button UseSubmitBehavior="false" runat="server" class="ms-ButtonHeightWidth" OnClick="BtnOK_Click" Text="<%$Resources:wss,multipages_okbutton_text%>" id="btnOK" accesskey="<%$Resources:wss,okbutton_accesskey%>"/>
			</asp:PlaceHolder>
		</Template_Buttons>
	</wssuc:ButtonSection>
</table>
</asp:Content>
<%@ Register TagPrefix="wssuc" TagName="TopNavBar" src="~/_controltemplates/TopNavBar.ascx" %>
<asp:Content contentplaceholderid="PlaceHolderTopNavBar" runat="server">
  <wssuc:TopNavBar id="IdTopNavBar" runat="server" Version="4" ShouldUseExtra="true"/>
</asp:Content>
<asp:Content contentplaceholderid="PlaceHolderHorizontalNav" runat="server"/>
<asp:Content contentplaceholderid="PlaceHolderSearchArea" runat="server"/>
<asp:Content contentplaceholderid="PlaceHolderTitleBreadcrumb" runat="server">
  <SharePoint:UIVersionedContent UIVersion="3" runat="server"><ContentTemplate>
	<asp:SiteMapPath
		SiteMapProvider="SPXmlContentMapProvider"
		id="ContentMap"
		SkipLinkText=""
		NodeStyle-CssClass="ms-sitemapdirectional"
		RootNodeStyle-CssClass="s4-die"
		PathSeparator="&#160;&gt; "
		PathSeparatorStyle-CssClass = "s4-bcsep"
		runat="server" />
  </ContentTemplate></SharePoint:UIVersionedContent>
  <SharePoint:UIVersionedContent UIVersion="4" runat="server"><ContentTemplate>
	<SharePoint:ListSiteMapPath
		runat="server"
		SiteMapProviders="SPSiteMapProvider,SPXmlContentMapProvider"
		RenderCurrentNodeAsLink="false"
		PathSeparator=""
		CssClass="s4-breadcrumb"
		NodeStyle-CssClass="s4-breadcrumbNode"
		CurrentNodeStyle-CssClass="s4-breadcrumbCurrentNode"
		RootNodeStyle-CssClass="s4-breadcrumbRootNode"
		HideInteriorRootNodes="true"
		SkipLinkText="" />
  </ContentTemplate></SharePoint:UIVersionedContent>
</asp:Content>

Open in new window

0
 
Ersoy HasanCommented:
Just hide the row with css.
0
 
jackjohnson44Author Commented:
Thanks RainerJ,

In case anyone else has this issue, if you are using FireBug and trying to execute javasript from the console window, you need to point to the iframe.  If you are calling from the master page like the example above, it will work.

from the
$(".ms-dlgFrame").contents().find("#ctl00_PlaceHolderMain_ifsSendEmail").hide();
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 7
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now