php - Remove the checked element from the page -
i have script thats send post via jquery.form addon:
$(document).ready(function() { $('#submit_btn').on('click', function(e) { $("#preview").html(''); $("#preview").html('<img src="loader.gif" alt="uploading...."/>'); $("#imageform").ajaxform({ target: '#preview', success: aftersuccess //call function after }); }); }); function aftersuccess() { $('#imageform').resetform(); $('.imgstatus').appendto('.img'); } and gets html respond.
<div id="<?php echo $randnumber; ?>" class="imgstatus"> <input id="<?php echo $randnumber; ?>" type="checkbox" name="<?php echo $randnumber; ?>" /> <img src='upload/<?php echo $actual_image_name; ?>' class='preview'> </div> and i'm trying remove div corresponds checkbox id, when delete button clicked. , send $_post php page checked divs. until have when press button not removing element...
$("#clickme").click(function(e){ var selected = $(".img input:checked").map(function(i,el){return el.name;}).get(); $(selected).remove(); }); jsfiddle.net/ahr6v/3
just change
$(selected).remove(); to
$('#'+selected).remove(); edit: or (to remove selected divs)
$.each(selected, function(){ $('#' + this).remove(); });
Comments
Post a Comment