javascript - Can't find the correct jQuery selector for this element -


i have repeating blocks of html :

<div class="pod-control">    <a class="fap-single-track"></a>      <a class="pod-dl"></a>      <div class="add-music"><a class="add_mycrate"></a></div>      <div class="added-music"></div>  </div> 

i'm using jquery info "a.add_mycrate" class , ajax stuff contents, working fine.

but on response trying .show .hidden div "added-music" , can't seem find correct selector it.

this i'm using :

var $this = jquery(this);                        jquery.post(mycrate.ajaxurl, data, function(response) {          $this.closest('.add-music').remove();          $this.closest('.pod-control').find('.added-music').show();          alert(response);     }); 

the line giving me trouble :

$this.closest('.pod-control').find('.added-music').show(); 

after reading bunch of posts know need move selector top level (from a.add_mycrate .pod-control) can .find .added-music know i'm doing wrong whatever try won't show div.

try removing .add-music after have shown .added-music. means: swap 2 lines above alert.

my suspicion is, since whole event bound link gets removed, stops executing code bound it.

edit: or don't remove() @ all, rather .hide() it.


Comments