So this is probably very easy but for some reason I can't get it to work. I have a $.get function that runs properly. I want the data/results to load into the closest div. When I identify the div specifically, everything works fine:
$.get( lk, function(data) {
$("div.tcontainer").html(data);
});
But when I try to look for the closest div, it does not work. I have a few divs on the page (dynamically) and they have the same attributes so i need to find the closes div and load the data like:
$.get( lk, function(data) {
$(this).closest("div.tcontainer").html(data);
});
But this does not work. Can someone help me find the closest div using the code above. Thank you.
Aucun commentaire:
Enregistrer un commentaire