Javascript Causes DOM Elements to Be Deleted <p>This is probably just another instance of me staring at the code for too long and missing something important. Basically, I have a script that in WebKit when a .click (jQuery) event occurs, fills another with the content of clicked item. However, for some reason, clicking multiple times upon an item causes the DOM element to be deleted. Any ideas? JSFiddle with code samples linked below.</p> <p>Here's the function that I think is the culprit:</p> <pre><code>$(".vote-divs .vote-div").click(function () { $(".vote-none").hide() $(".step-2-column-left .vote-div").each(function () { $(this).hide(); }); $("#" + $(this).attr("id") + "-s").show(); $(".confirm-s").each(function () { $(this).hide(); }); if ($(this).attr("id") == "vote-grow") { $("#donation-vote-for").val("Grow"); $("#confirm-grow-s").show(); } else if ($(this).attr("id") == "vote-stache") { $("#donation-vote-for").val("Stache"); $("#confirm-stache-s").show(); } else if ($(this).attr("id") == "vote-shave") { $("#donation-vote-for").val("Shave"); $("#confirm-shave-s").show(); } else if ($(this).attr("id") == "vote-mutton") { $("#donation-vote-for").val("Mutton"); $("#confirm-mutton-s").show(); } else if ($(this).attr("id") == "vote-manchu") { $("#donation-vote-for").val("Manchu"); $("#confirm-manchu-s").show(); } console.log(event.target); $(".vote-none").html(event.target); goTo("3"); }); </code></pre> <p><a href="http://jsfiddle.net/wrVGQ/" rel="nofollow" title="JSFiddle">JSFiddle</a></p>