Custom Radio-Checkbox Plugin

Content loaded via AJAX

*important: Use the "for" attribute in the <label> to support IE6

Use $('selector').customRadioCheckbox(); to replace radios & checkboxes after the content is loaded

Load content

Form result:

The HTML from ajax-loaded-content.html

			
		

And the jQuery to load the content:

After loading the content, form.customRadioCheckbox() is called to replace radios & checkboxes

			
$(function() {
var link = $('#load_content'),
url = link.attr('href'),
container = $('#demo_ajax');

link.click(function(e) {
e.preventDefault();
container.load(url, function() {
	var form = $('#form');
	$('#html_output').text(form.parent().html());

	// customize radio and checkbox for the loaded content
	// and handle the submit function to show the results
	form.customRadioCheckbox()
	.submit(function(e) {
		e.preventDefault();
		$('#result').html(form.serialize());
	});
});
});
});