Optional Fields jQuery Plugin

A jQuery plugin as requested by Andy Clarke (http://stuffandnonsense.co.uk, @Malarkey) to have effect as described in Andy Clarke's original blog post

Example usage

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
 <script src="jquery.toggleOptionalFields.js" type="text/javascript"></script>

	<script>
		$(document).ready(function()
		{
			$("#example-form").toggleOptionalFields(); 
		});
	</script>

 

Download source -

Grab a minified version

Update in line with comments on the original blog post this plugin has been updated to ensure it encompasses the spirit of progressive enhancement and below is a live example using Andy Clarke's original markup and css.

Original form example














This work including the javascript source code is licensed under a Creative Commons Attribution 2.0 UK: England & Wales License