I’ve made an AdminCP to manage all my recipes, users, details etc… So, I’m running this code here that move my recipes from shared to drafted. Everything is fine, it’s normally working but I would like to hide the TD that It contains the button that I’ve clicked.
$(document).on("click", "[data-action]", function(e){
e.preventDefault();
if(window.confirm("Are you sure to draft this Article?")){
var draft_id = $(this).attr("data-id");
var action = $(this).attr("data-action");
$.ajax({
url: "actions-recipe",
type: "post",
data: {
draft_id:draft_id,
action:action
},
success: function(data){
// I would like to hide the td that it contains this button
}
});
}else{
return false;
}
});
Hi, thanks for your helping! Yep, i’ve done it but i’ve got only one question: because i’ve got only one div as td, what it happens if i’ve got multiple td? I will hide all of them or just the td that it contains the button that i’ve clicked?
Comment posted by stackoverflow.com/a/65596953/6082661
check this :
Comment posted by Jun
@VittoAlloggio I’m glad it helped. To answer the question, only the td that got “myid” will hide. another td tag will not hide if you don’t give the same id
Comment posted by Vitto Alloggio
Thanks @jun for your helping. I’ve tested this code with multiple div and it’s hiding only the div that it contains the button that i’ve clicked. I wish you a great day! 🙂
Comment posted by Vitto Alloggio
Hi, I’ve already tried this before but it’s not what I’m looking for. This hide the button that i’ve clicked and not the div that It contains the buttton..
Comment posted by Sachin Sanchaniya
I updated my answer as per your requirement.
Comment posted by Vitto Alloggio
How can i run this after $(document).ready(function(){ without hiding all the divs that they contain the class dropdown but only the div that i select by button?