admin管理员组文章数量:1317565
Problem is that cant disable native "on click" event that triggers x-editable to transform into textarea. I want that only Button could tranfsorm text to textarea, So that on text is non-clickable.
I found questions how to trigger x-editable on other element click. But how to disable native text click and leave only other element's event ?
Fiddle with problem is here:
This part works great:
$('.edit-post-button').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$textarea = $(this).closest('.media-body').find('.editable');
$textarea.editable('toggle');
});
But when trying to disable native text click, it wont work, or I'm doing something wrong here ?
$('.editable-post-textarea').on('click', function(e) {
console.log('native-click-triggered!');
e.stopPropagation();
});
Here is sample with my problem: /
So how to disable native "click" event on textarea, and leave trigger only on "EDIT TEXT" button?
Problem is that cant disable native "on click" event that triggers x-editable to transform into textarea. I want that only Button could tranfsorm text to textarea, So that on text is non-clickable.
I found questions how to trigger x-editable on other element click. But how to disable native text click and leave only other element's event ?
Fiddle with problem is here:
This part works great:
$('.edit-post-button').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$textarea = $(this).closest('.media-body').find('.editable');
$textarea.editable('toggle');
});
But when trying to disable native text click, it wont work, or I'm doing something wrong here ?
$('.editable-post-textarea').on('click', function(e) {
console.log('native-click-triggered!');
e.stopPropagation();
});
Here is sample with my problem: http://jsfiddle/jjdJX/64/
So how to disable native "click" event on textarea, and leave trigger only on "EDIT TEXT" button?
Share Improve this question edited Feb 18, 2014 at 13:10 Mike Causer 8,3242 gold badges46 silver badges63 bronze badges asked Jan 23, 2014 at 12:45 user991user991 1,3693 gold badges25 silver badges45 bronze badges2 Answers
Reset to default 3Disable elements' click event using:
$('.editable-post-textarea').off('click');
Fiddle: http://jsfiddle/jjdJX/65/
In version 1.5.1 you can set a 'toggle' option with a 'manual' value
$('.editable').editable({
toggle: 'manual'
});
Doing this has the nice side effect of removing the dashed-underline decoration in the editable field.
source official x-editable docs
本文标签: javascriptXeditable toggle on click How to disable native element clickStack Overflow
版权声明:本文标题:javascript - X-editable toggle on click. How to disable native element click? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742020464a2414494.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论