?
Solved

css jquery hide tr

Posted on 2013-05-14
17
Medium Priority
?
701 Views
Last Modified: 2013-05-14
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
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
  • +2
17 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39164732
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
 

Author Comment

by:jackjohnson44
ID: 39164752
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
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39164779
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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:jackjohnson44
ID: 39164784
This is also in a SharePoint popup, but I didn't think that would be an issue.
0
 

Author Comment

by:jackjohnson44
ID: 39164790
Thanks, that is why I am asking.
0
 
LVL 4

Expert Comment

by:Ersoy Hasan
ID: 39164799
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
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39164802
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
 

Author Comment

by:jackjohnson44
ID: 39164845
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
 
LVL 30

Expert Comment

by:LZ1
ID: 39164906
Do you have a live URL?
0
 

Author Comment

by:jackjohnson44
ID: 39164920
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
 
LVL 30

Expert Comment

by:LZ1
ID: 39164933
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
 

Author Comment

by:jackjohnson44
ID: 39164945
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
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39164983
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
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39165097
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
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 2000 total points
ID: 39165254
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
 
LVL 4

Expert Comment

by:Ersoy Hasan
ID: 39165266
Just hide the row with css.
0
 

Author Comment

by:jackjohnson44
ID: 39166147
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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question