I want to display a textarea-element with bootbox. This textarea should be used with a WYSIWYG-editor, which will be initialized by
$('#editor').redactor();
So I want to add this in the moment the textarea is displayed. I tried this:
bootbox.dialog({
title: "Title",
message: '<textarea id="editor"></textarea>',
init: function () {
$('#editor').redactor();
}
});
But this seems to be wrong.
I want to display a textarea-element with bootbox. This textarea should be used with a WYSIWYG-editor, which will be initialized by
$('#editor').redactor();
So I want to add this in the moment the textarea is displayed. I tried this:
bootbox.dialog({
title: "Title",
message: '<textarea id="editor"></textarea>',
init: function () {
$('#editor').redactor();
}
});
But this seems to be wrong.
Share Improve this question asked Oct 27, 2015 at 7:57 user3142695user3142695 17.4k55 gold badges200 silver badges375 bronze badges 4-
The issue is because
init()
is called before the UI of the dialog is in the DOM. This plugin seems extremely poor in the fact that it doesn't have any events you can hook to when content is displayed/hidden. For that reason I would suggest you use a different plugin pletely. – Rory McCrossan Commented Oct 27, 2015 at 8:01 - what would you remend? – user3142695 Commented Oct 27, 2015 at 8:02
- Have a search, there are literally hundreds of dialog libraries. – Rory McCrossan Commented Oct 27, 2015 at 8:02
- @RoryMcCrossan Well, bootbox is simply a wrapper around Bootstrap's modals, so it has those events: getbootstrap./javascript/#modals-events. Or, were you looking for events for when bootbox is generating it's own content for it's alert, confirm, and prompt helpers? – Tieson T. Commented Oct 29, 2015 at 4:42
1 Answer
Reset to default 7Just add a show event:
var box = bootbox.dialog({
title: "Title",
message: '<textarea id="editor"></textarea>'
});
box.bind('shown.bs.modal', function(){
$("#editor").redactor();
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745174007a4615099.html
评论列表(0条)