Jeditable edit all sections?

I am trying to figure out how to edit all areas with a specific class with a single edit button.

This is my JS: I threw it into a function that will be used again. I have a surrounding div, and inside it there are gaps with classes of "details"

How to create 1 "edit" button and make them run at the same time? Trying to simulate the facebook effect where, if you click on a section, the entire section will become editable. Not sure how to do this.

function editProfileText(url, selector, type, data) {
      $(selector).editable(url, { 
        cssclass : 'inline-edit',
        //data   : data,
        id   : 'elementid',
        name : 'elementvalue',
        indicator : '<img src="/assets/images/ajax-loader.gif">',
        tooltip   : 'Click to edit...',
        submit: 'Save',
        event: "edit",
        //onblur : 'ignore',
        type: type

 });

 }   
    //Link for Text Only
    $('a.edit').live('click', function(){
        editProfileText("profile/editprofile", "span.detail" , "text", "");
        $(this).prev().trigger("edit");
    });

Decision:

function editProfileText(url, selector, type, data) {
          $(selector).editable(url, { 
            cssclass : 'inline-edit',
            //data   : data,
            id   : 'elementid',
            name : 'elementvalue',
            indicator : '<img src="/assets/images/ajax-loader.gif">',
            tooltip   : 'Click to edit...',
            submit: 'Save',
            event: "click",
            //onblur : 'ignore',
            type: type

     });

     }   
$('a.edit').live('click', function(){
        editProfileText("profile/editprofile", "span.detail" , "text", "");
         $('span.detail').trigger('click');
});
+3
source share
1 answer

You can always use the "Change" button to trigger a click event on editable elements, for example:

$('a.edit').live('click', function(){
    $('input.edit').trigger('click');
});
+2

Source: https://habr.com/ru/post/1715478/


All Articles