jquery - Remove imgs from container if container possess a div with a certain class -


i have divs imgs in them. however, few of these divs have span first element within div. span represents 'label' imgs within div.

i have script going if hold alt , click on 'packet' div, it'll removed. however, not want remove packets have labels in them. ones, removing imgs within enough.

i've been having trouble establishing logic. well, convey ability delete clicking , holding alt key, attempted have css property change colors cue. too, not work.

$(".card_packet").click(function (e) {     if (e.altkey) {          $(this).live('hover', function(event) {             if (event.type === 'mouseover') {                 $(this).css({                     'border-color': 'red'                 });             }             else {                 $(this).css({                     'border-color':'black'                 });             }         });          if ($(this).find('sect_header')) { //if div contains label, remove images. otherwise, remove whole thing.             $(this).remove('img');         } else {             $(this).remove();         }     } }); 

i'm sure has order of operations.

if($(this).children(":first").is("span")){ //if div contains label, remove images..    $(this).find('img').remove(); }else{ //otherwise remove packet div    $(this).remove(); } 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -