Hey All,

I'm trying to dynamically add a list of check boxes (and an associated
click event
handler) to my page.  Problem is, when I click on a box, the event is
fired multiple times (once per checkbox on the page).  I don't really
understand this behaviour - the event should only fire once.  I would
graciously appreciate any suggestions you may have.

Regards

Patrick

Code snippit :

<script type="text/javascript">

$(function() {

$.ajax({
    type: "GET",
    url: "./?get=Lignes",
    dataType: "xml",
    cache: false,
    success: function(xml){

$(xml).find("Lignes").each(function() {

var line = $(this);
$("#filters")
.append("<input type='checkbox' value=" + line.attr("ID") + ">")
.click(function() {
$("#map").append("wtf??").append("<br/>"); return false;
})
.append(line.attr("Nom")).append("<br/>");

});

}

});

});

</script>

Reply via email to