X - editable input editable on click on other element

谁都会走 提交于 2019-12-02 16:44:39

It has a function called enable you can use that to enable edit

$('.edit').click(function(e){    
       e.stopPropagation();
       $('#publicname-change').editable('toggle');
});

This won't work if you don't add the first line because default behaviour is to disable edit on click of any other element.

Edit:

To enable editing only on the click of edit button and not the text, set toggle property to manual.

$('#publicname-change').editable({
    type: 'text',
    url: '/post',
    pk: 1,
    placement: 'top',
    title: 'Enter public name',
    toggle:'manual'
}

JSFiddle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!