Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending the parent's ID as a parameter in jEditable

Tags:

jquery

Given

$(".foo").editable("script.php")

How can I pass the ID of .foo's parent as a parameter? I've tried

$(".foo").editable("script.php", { 

     submitdata: {

          parent_id: $(this).parent().attr('id')

                 }
     });

and every variant of that I can think of, but it just seems like the $(this) object is not working in this context.

like image 356
Matthew Avatar asked Dec 10 '22 21:12

Matthew


1 Answers

I had the same problem here, found the following solution:

$('.jeditable').each(function() {
   var $this = $(this);
   $this.editable('submit.jsp', {
      submitdata  : { parent_id : $this.parent().attr('id') }
   });
});
like image 72
user168162 Avatar answered Dec 13 '22 15:12

user168162