4

I can't seem to get the proper return of "id" from my Jeditable function.

Code looks like this:

<li id="249" rel="4">
    <span title="Double-click to edit...">EDIT THIS TEXT</span>
<div class="tab"></div>
</li>

I call the jeditable function like so:

bindAllTabs("#list li span");

    function bindAllTabs(editableTarget) {

    $(editableTarget).editable("db-interaction/lists.php", {
        indicator : 'Saving...',
        tooltip   : 'Double-click to edit...',
        event     : 'dblclick',
        submit    : 'Save',
        submitdata: {action : "update"}

    }); 

How can I send the "id" from the parent? I need to keep them separate since I have other s listed below the editable text -- so I'm using the as an identifier. However, since I've put the ID in the parent I can't seem to access it with jeditable.

Help?

cTho
  • 57
  • 3

1 Answers1

2

Try this solution

function bindAllTabs(editableTarget) {

        $(editableTarget).editable("db-interaction/lists.php", {
            indicator : 'Saving...',
            tooltip   : 'Double-click to edit...',
            event     : 'dblclick',
            submit    : 'Save',
            submitdata: function( value, settings){
              var parent_id = $(this).parent('li').attr('id');
              return { action : 'update', id : parent_id};  
            }

        }); 

    }
user5200704
  • 1,689
  • 11
  • 10