Javascript 获取当前froala编辑器的ID
我在Froala编辑器中添加了一个自定义按钮Javascript 获取当前froala编辑器的ID,javascript,jquery,froala,Javascript,Jquery,Froala,我在Froala编辑器中添加了一个自定义按钮 $.FroalaEditor.DefineIcon('yt', {NAME: 'plus'}); $.FroalaEditor.RegisterCommand('yt', { title: 'make yt', focus: true, undo: true, refreshAfterCallback: true, callback: function () { console.log(t
$.FroalaEditor.DefineIcon('yt', {NAME: 'plus'});
$.FroalaEditor.RegisterCommand('yt', {
title: 'make yt',
focus: true,
undo: true,
refreshAfterCallback: true,
callback: function () {
console.log(this);
}
});
当我单击按钮时,显示console.log(此)
我看到了我想要的DIV的ID(#jobEditor)。
如何从“this”中提取它?this.$box.prop('id')
或
this.$box[0].id
b {id: 1, opts: {…}, sid: 1, shared: {…}, $oel: m.fn.init(1), …}
$box:m.fn.init [div#jobEditor.fr-box.fr-basic.fr-top, context: div#jobEditor.fr-box.fr-basic.fr-top]
$doc:m.fn.init [document, context: document]
$el:m.fn.init [div.fr-element.fr-view]
$oel:m.fn.init [div#jobEditor.fr-box.fr-basic.fr-top, context: di...
(more stuff)