Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
<html lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Really annoying IE6/7 radio name bug</title>
<script type="text/javascript" charset="utf-8" src=""></script>
<script type="text/javascript" charset="utf-8">
$(function() {
// Create some using clone
for(var i=0; i<3; i=i+1) {
// Set a unique name
.attr("name", "input-" + $("input").length)
$("<p/>").text("Now we'll use outerHTML to add some:").appendTo("body");
// Create some using outerHTML
for(var i=0; i<3; i=i+1) {
var newRadioHTML = $("input[name='template']").attr("outerHTML");
newRadioHTML = newRadioHTML.replace('template','input-' + $("input").length);
$("input").live("click", function() {
$("<p/>").text($(this).attr("name") + " clicked").appendTo("body");
<input name="template" type="radio">
<p>Here we should have a bunch of independently checkable radio buttons:</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment