Sean Carter

Ramblings about SharePoint, C# and ASP.NET

Zebra-striping SharePoint Questions in SharePoint Survey

with 3 comments

Achieving zebra striping in survey questions (helping users to distinguish between questions) is very easy with JQuery…

….you can add the following in the PlaceHolderAdditionalPageHead section in SharePoint Designer for NewForm.aspx and EditForm.aspx (simply copy the script and style sections below):


<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
	
	<style type="text/css">
		.oddrow { background : #eee9e9 !important;}
	</style>

	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
	<script type="text/javascript">
	$(document).ready(function () {
		$('td.ms-formbodysurvey table tbody tr:odd').addClass("oddrow");
	});
	</script>
	
	<SharePoint:UIVersionedContent UIVersion="4" runat="server"><ContentTemplate>
		<SharePoint:CssRegistration Name="forms.css" runat="server"/>
	</ContentTemplate></SharePoint:UIVersionedContent>
</asp:Content>


About these ads

Written by Sean Carter

July 1, 2011 at 3:24 pm

3 Responses

Subscribe to comments with RSS.

  1. could be improved by using this to only select the tables with attribute summary=”rating..”

    $(‘table[summary]>tbody>tr:odd’).addClass(“oddrow”);

    mark mcadam

    March 27, 2012 at 1:01 am

  2. well done !!!! u just made my day :-)

    Haider

    October 8, 2012 at 11:57 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: