开发者

Invoke Jeditable from link

I开发者_如何学编程'm trying to build edit in place functionality, but I want to invoke element with outside link. Lets say I'm building right-click menu with edit.

Thank you for help


If I understand what you want correctly, you want to do the following:

  • Only make an element editable when a user do some action (e.g. click a button)
  • After the user finishes editing the element, the element becomes uneditable again, until the triggering action is performed again.

If that's the case, you can do something like this:

$('button').click(function() {  // an action to trigger editing
    $('#editable').editable('', {
        // when the editing is done, make this element uneditable
        onreset: function() { $(this).parent().editable('destroy'); }
    })
    // pseudo click the editable element, so it is in the "editable" mode
    .click(); 
});

Example: http://jsfiddle.net/william/DqbeN/.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜