[jQuery] cloneinf TR with event

[jQuery] cloneinf TR with event


I have a working solution to this but can't help thinking I am missing
an easier way.
I have a table that is prepoulated server side and the user has the
ability to add a row. one of the inputs has a function bound to the
keyup event. wether I clone(true) or clone() the attribute fonkeyup
seems to be clones, so I need to remove it and then bind another. my
code is below, olease could someone look and see if there is an easy/
better way to do this/
thanks
P
$("#AddElement").click(function() {
                var clone = $("#CostRow\\[0\\]").clone(true);
                $(clone).find("input").each(function() {
                    var s = $(this).attr("id");
                    s = s.replace("0", costscount);
                    $(this).attr("name", s);
                    $(this).attr("id", s);
                    $(this).attr("value", '0');
                });
                $(clone).find("#costs\\.Index").val(costscount);
                $(clone).find("#costs\\[" + costscount + "\\]\\.GrossCost").attr
("onkeyup","");
                $(clone).find("#costs\\[" + costscount + "\\]\\.GrossCost").bind
("keyup",function() {Add(costscount);});
                costscount++;
                $("#CostTable").append(clone);
                $("#CostTable tr:even").addClass("even");
                return false;
            });