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',
id : 'elementid',
name : 'elementvalue',
indicator : '<img src="/assets/images/ajax-loader.gif">',
tooltip : 'Click to edit...',
submit: 'Save',
event: "edit",
type: type
});
}
$('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',
id : 'elementid',
name : 'elementvalue',
indicator : '<img src="/assets/images/ajax-loader.gif">',
tooltip : 'Click to edit...',
submit: 'Save',
event: "click",
type: type
});
}
$('a.edit').live('click', function(){
editProfileText("profile/editprofile", "span.detail" , "text", "");
$('span.detail').trigger('click');
});