function evaluation

function evaluation

Hi all:  I am loving JQuery and have what I hope is an easy newbie question.  I don't know how to control the evaluation of my bound functions.  In the code below, I want each of the five anchors to alert with its index. Instead, they are showing the value of the index.  How can I get my click function to evaluate that index inside the loop?  Know what I mean??
 

<

html>

<

head>

<title>JQ function evaluation primer</title>

<script type="text/javascript" src="jquery-1.3.2.js"></script>

<script type="text/javascript">

$(document).ready(

function() {

for (var i = 0; i < 5; i++) {

var a = $("<a />").attr({ "href": "#" }).text("Click for " + i);

a.click(

function() { alert("You see " + i); });

$(

"#div1").append($("<div/>")).append(a);

}

});

</script>

</

head>

<

body>

<div id="div1"></div>

</

body>

</

html>