[jQuery] trouble defining post variable when form element is dynamic

[jQuery] trouble defining post variable when form element is dynamic


Hi there, I am having this problem but no real ideas on how to solve
it. I have a edit profile form that is loaded using .load. Within it I
have a form for editing email addresses with a list of email addresses
above it, this is also loaded/reloaded as a callback when a state
change in the emails occurs. The user can add emails, make an email a
primary and delete emails. My issue is with deleting:
        $(".removeemail").change( function() {
            $.post("js/edit/edit_email.php", { task: "setprimary", email_ID: $
("EMAIL ID correspending to the delete button").val() },function(html)
{
                $("#emails").html(html);
            });
        });
My issue is with deleting. How do I set the email_ID value without a
form element only php generated html. Before I would of used
onchange="somejavascriptfunction(<?php echo $email_id"; ?>)" on the
delete button but I cannot think of a way of doing this in jquery
without using a select radio button type thing like I have done for
setting primary email. Any ideas?