<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JQuery Archives | DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/tag/jquery/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Tue, 23 Dec 2025 15:48:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://static.dmcinfo.com/wp-content/uploads/2025/04/site-icon-150x150.png</url>
	<title>JQuery Archives | DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Hide Fields on a SharePoint Form</title>
		<link>https://static.dmcinfo.com/blog/25912/how-to-hide-fields-on-a-sharepoint-form/</link>
		
		<dc:creator><![CDATA[Curtis Weir]]></dc:creator>
		<pubDate>Tue, 02 Feb 2016 12:23:02 +0000</pubDate>
				<category><![CDATA[Digital Workplace Solutions]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/25912/how-to-hide-fields-on-a-sharepoint-form/</guid>

					<description><![CDATA[<p>Hiding fields in a SharePoint form can be tedious, or sometimes not even possible using out-of-the-box features. One common solution is to modify the forms in SharePoint Designer. However, this takes time and is prone to user error. A simpler solution is to use Javascript &amp; jQuery, and the following code outlines how to hide [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/25912/how-to-hide-fields-on-a-sharepoint-form/">How to Hide Fields on a SharePoint Form</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Hiding fields in a SharePoint form can be tedious, or sometimes not even possible using out-of-the-box features. One common solution is to modify the forms in SharePoint Designer. However, this takes time and is prone to user error.</p>



<p class="wp-block-paragraph">A simpler solution is to use Javascript &amp; jQuery, and the following code outlines how to hide any field on your SharePoint form. If you are unfamiliar with Javascript, no problem! Just edit the <em>fieldsToHide</em> line with whatever fields you wish to hide. Separate fields using commas, and surround each field with quotations.</p>



<p class="wp-block-paragraph">If you would like to understand how the code works in detail, read the following section. If not, skip to Adding the Code to Your SharePoint Site.</p>



<h2 class="wp-block-heading" id="h-the-code">The Code</h2>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>&lt;script src="//code.jquery.com/jquery-latest.min.js">&lt;/script>
&lt;script>
	function HideFields() {
		//Enter the fields you would like to hide here.
		fieldsToHide = &#91;"Enter", "Field Names", "Here"&#93;;
	
		//Get all SharePoint fields
		var formFieldTitles = $(".ms-formtable td.ms-formlabel h3.ms-standardheader");

		//Iterate over each row in the form
		formFieldTitles.each(function () {
			//Get the text of the field title
			var textToMatch = $(this).text();
			//Get the table row associated with this title
			var currentRow = $(this).closest('tr');

			//Iterate over our list of fields we wish to hide
			for (var i = 0; i &lt; fieldsToHide.length; i++){
				var field = fieldsToHide&#91;i&#93;;
				//Match the SharePoint field name to our field name
				if (textToMatch.toLowerCase().replace("*", "").trim() === field.toLowerCase().replace("*", "").trim()){
					//Hide this field
					$(currentRow).hide();
				}
			}
		});
	}

	function AddToBodyOnLoad(){
		//Ensure that our function is called last by pushing it again
		_spBodyOnLoadFunctionNames.push("HideFields");
	}

	//Add our function to the array of onload functions
	_spBodyOnLoadFunctionNames.push("AddToBodyOnLoad");
&lt;/script></textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">script</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">src</span><span style="color: #D4D4D4">=</span><span style="color: #CE9178">&quot;//code.jquery.com/jquery-latest.min.js&quot;</span><span style="color: #808080">&gt;&lt;/</span><span style="color: #569CD6">script</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">script</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #D4D4D4">	function HideFields() </span><span style="color: #569CD6">{</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #6A9955">//Enter the fields you would like to hide here.</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #9CDCFE">fieldsToHide</span><span style="color: #D4D4D4"> = &#91;</span><span style="color: #CE9178">&quot;Enter&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;Field Names&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;Here&quot;</span><span style="color: #D4D4D4">&#93;;</span></span>
<span class="line"><span style="color: #D4D4D4">	</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #6A9955">//Get all SharePoint fields</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #9CDCFE">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">formFieldTitles</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">$</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;.ms-formtable td.ms-formlabel h3.ms-standardheader&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #6A9955">//Iterate over each row in the form</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #9CDCFE">formFieldTitles</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">each</span><span style="color: #D4D4D4">(</span><span style="color: #569CD6">function</span><span style="color: #D4D4D4"> () {</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #6A9955">//Get the text of the field title</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">textToMatch</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">$</span><span style="color: #D4D4D4">(</span><span style="color: #569CD6">this</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">text</span><span style="color: #D4D4D4">();</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #6A9955">//Get the table row associated with this title</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">currentRow</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">$</span><span style="color: #D4D4D4">(</span><span style="color: #569CD6">this</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">closest</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&apos;tr&apos;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #6A9955">//Iterate over our list of fields we wish to hide</span></span>
<span class="line"><span style="color: #D4D4D4">			</span><span style="color: #C586C0">for</span><span style="color: #D4D4D4"> (</span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4"> = </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">; </span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4"> &lt; </span><span style="color: #9CDCFE">fieldsToHide</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">length</span><span style="color: #D4D4D4">; </span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">++){</span></span>
<span class="line"><span style="color: #D4D4D4">				</span><span style="color: #569CD6">var</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">field</span><span style="color: #D4D4D4"> = </span><span style="color: #9CDCFE">fieldsToHide</span><span style="color: #D4D4D4">&#91;</span><span style="color: #9CDCFE">i</span><span style="color: #D4D4D4">&#93;;</span></span>
<span class="line"><span style="color: #D4D4D4">				</span><span style="color: #6A9955">//Match the SharePoint field name to our field name</span></span>
<span class="line"><span style="color: #D4D4D4">				</span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">textToMatch</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">toLowerCase</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">replace</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;*&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">trim</span><span style="color: #D4D4D4">() === </span><span style="color: #9CDCFE">field</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">toLowerCase</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">replace</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;*&quot;</span><span style="color: #D4D4D4">, </span><span style="color: #CE9178">&quot;&quot;</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">trim</span><span style="color: #D4D4D4">()){</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #6A9955">//Hide this field</span></span>
<span class="line"><span style="color: #D4D4D4">					</span><span style="color: #DCDCAA">$</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">currentRow</span><span style="color: #D4D4D4">).</span><span style="color: #DCDCAA">hide</span><span style="color: #D4D4D4">();</span></span>
<span class="line"><span style="color: #D4D4D4">				}</span></span>
<span class="line"><span style="color: #D4D4D4">			}</span></span>
<span class="line"><span style="color: #D4D4D4">		});</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">	function AddToBodyOnLoad()</span><span style="color: #569CD6">{</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #6A9955">//Ensure that our function is called last by pushing it again</span></span>
<span class="line"><span style="color: #D4D4D4">		</span><span style="color: #9CDCFE">_spBodyOnLoadFunctionNames</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">push</span><span style="color: #D4D4D4">(</span><span style="color: #CE9178">&quot;HideFields&quot;</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">	</span><span style="color: #569CD6">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">	//Add our function to the array of onload functions</span></span>
<span class="line"><span style="color: #D4D4D4">	_spBodyOnLoadFunctionNames.push(&quot;AddToBodyOnLoad&quot;);</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">script</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p class="wp-block-paragraph">The first line imports the jQuery library, which makes it easier to select and hide elements on a page. To learn more about jQuery, visit <a href="https://jquery.com/" target="_blank">their official website</a>.</p>



<p class="wp-block-paragraph">The first line in <em>HideFields()</em> defines which fields we are going to hide. This is the line that you should change to match the fields on your form, and add additional fields if desired.</p>



<p class="wp-block-paragraph">The <em>AddToBodyOnLoad()</em> function forces our function to be loaded last on the page. This ensures that the fields have been created and are viewable in the DOM.</p>



<p class="wp-block-paragraph">The <em>HideFields()</em> function iterates over each field on the form, then iterates over each field in our list of fields we want to hide. If there’s a match, the entire row is hidden from view. Unfortunately, we cannot remove this row from the DOM, since there will be unintended side-effects, and SharePoint will not be able to save the list item.</p>



<h2 class="wp-block-heading" id="h-adding-the-code-to-your-sharepoint-site">Adding the Code to Your SharePoint Site</h2>



<h3 class="wp-block-heading" id="h-sharepoint-2013-amp-office-365">SharePoint 2013 &amp; Office 365</h3>



<ol class="wp-block-list">
<li>Navigate to your SharePoint list.</li>



<li>In your browser url, replace <em>AllItems.aspx</em> with the name of the form (default forms are NewForm.aspx, EditForm.aspx, and DispForm.aspx).</li>



<li>Click the Gear icon in the top right, then “Edit Page”.</li>



<li>Click “Add a Web Part”.</li>



<li>Under “Categories”, select “Media and Content”.</li>



<li>Under “Parts”, select “Script Editor”.</li>



<li>On the new Web part, click “Edit Snippet”.</li>



<li>Copy the code from above, and paste the contents into the dialog.</li>



<li>Edit the 5<sup>th</sup> line with the fields you want to hide on this form.</li>



<li>Click “Insert”.</li>



<li>In the top left, click “Page”, then “Stop Editing”.</li>



<li>Your fields should now be hidden from view.</li>
</ol>



<h3 class="wp-block-heading" id="h-sharepoint-2010">SharePoint 2010</h3>



<ol class="wp-block-list">
<li>Navigate to your SharePoint list.</li>



<li>In your browser URL, replace <em>AllItems.aspx</em> with the name of the form (default forms are NewForm.aspx, EditForm.aspx, and DispForm.aspx).</li>



<li>Click the “Site Actions” in the top left, then “Edit Page”.</li>



<li>Click “Add a Web Part”.</li>



<li>Under “Categories”, select “Media and Content”.</li>



<li>Under “Parts”, select “Content Editor”.</li>



<li>On the new Web part, click “Click here to add new content”.</li>



<li>In the “Editing Tools” ribbon section, click “Format Text”.</li>



<li>In the “Markup” section, click “HTML”, then click “Edit HTML Source”.</li>



<li>Copy the code from above, and paste the contents into the dialog.</li>



<li>Edit the 5<sup>th</sup> line with the fields you want to hide on this form.</li>



<li>Click “OK”.</li>



<li>In the top left, click “Page”, then “Stop Editing”.</li>



<li>Your fields should now be hidden from view.</li>
</ol>



<p class="wp-block-paragraph"><a href="/services/digital-workplace-solutions/microsoft-consulting-services/sharepoint">Learn more about DMC&#8217;s SharePoint services.</a></p>



<p class="wp-block-paragraph"><a href="/contact">Contact us</a> for <a href="/services/digital-workplace-solutions/microsoft-consulting-services/sharepoint">SharePoint</a> consulting.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/25912/how-to-hide-fields-on-a-sharepoint-form/">How to Hide Fields on a SharePoint Form</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
