I want to create a button that has a jQuery click on the fly. After the user is done and hit the button I want to destroy the button and the jQuery click until a time I need it
Live would work just fine. If you'd like to avoid using live, you can wire up the the new button as you add it to the DOM.
function addNewButton() {
$("sweet_selector_here").append("");
$("#sweetness").click(function() {
$(this).remove();
});
}
With live it becomes this:
function addNewButton() {
$("sweet_selector_here").append("");
}
$("#sweetness").live("click", function() {
$(this).remove();
});