troubleshooting Question

Problem: Using jquery's ".live" within an ".each" loop

Avatar of the_sleeper
the_sleeperFlag for United States of America asked on
4 Comments1 Solution590 ViewsLast Modified:

I've set up a little test to learn how to use jquery's .live options.

3 hard-coded radio buttons
1 dynamic radio button
Test the click event

After several attempts at using live...all failed. Using .bind() works, but not on the dynamic field ((see code below)) .  How should this script be adapted to use the jquery .live() method?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">

$(document).ready(function() {

					alert("index: " + index + " value = " + $(this).val())	
			) // end bind
		} // end function
	) // end each
	// dynamic field test
	$('<input type="radio" name="rdo_test" value="4" />Test 4<br />').appendTo('body');


<input type="radio" name="rdo_test" value="1" />Test 1<br />
<input type="radio" name="rdo_test" value="2" />Test 2<br />
<input type="radio" name="rdo_test" value="3" />Test 3<br />


Open in new window

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros