[jQuery] posting onclick a datepicker value

[jQuery] posting onclick a datepicker value


Hello:
There is an onclick event that calls the changeStartDate, and passes
in an ID.
'<input class="InfoBoxLong datepicker" type="text" size="7"
id="StartDate_' + TransactionOrderItemID + '" onClick="changeStartDate
(\'' + TransactionOrderItemID + '\')" value="' + ActivationStartDate
+ '"></input>' +
First time, it passes in the correct ID to function. It has the
correct behavior the first time. But, after that, it keeps the old
item id, even though a new id is received in the function.
var ItemNoForDate;
    function changeStartDate(ItemNoForDate){
        alert (ItemNoForDate);
        $(".datepicker").datepicker({
         dateFormat: 'yy-mm-dd',
        onClose: function(dataText, inst){
        $.ajax({
            type: "POST",
            url: "php/ChangeStartDate.php",
            data: "NewDate=" + dataText + "&ItemInfo=" + ItemNoForDate,
            success: function(msg){
                    alert (msg);
            }
            });
        }
        });
    }
Any feedback on this is appreciated. Thanks.
Regards,
Nat