Quantcast
Channel: SharePoint 2010 – jbmurphy.com
Viewing all articles
Browse latest Browse all 10

A better jQuery selector to hide a row in a SharePoint 2010 Edit Form

$
0
0

In the past, I had used this code to hide a row in a SharePoint Edit Form (EditForm.aspx):

$('nobr:contains("Attendees")').closest('tr').hide();

The problem with this is that if you have two fields that contain the text “Attendees” (For example “NewAttendees” & “OldAttendees”), then it matches both of them (this always seems to to be an issue for us). So I did a little research and I found a better way to select a row (I think this was my original source)

Here is my new/better way to match a row:

 $('nobr').filter(function () { return $(this).text() === 'Attendees' }).closest('tr').hide();

If it was a required field, it would be:

 $('nobr').filter(function () { return $(this).text() === 'Attendees *' }).closest('tr').hide();

Hope that helps someone.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images