Kindeditor when used with Requirejs, ready fails

Source: Internet
Author: User

Kindeditor official documentation is used when using Kindeditor:

Kindeditor.ready (function (K)) {        k.create (' #editor_id ');}

Use the ready that you provided to create a rich text box after the DOM is loaded. In general, there will be no problem, I am also available in the dome. Today formally put the code until the project, the same moth appeared, rich text box does not appear. It took one hours to locate the problem to ready. The problem is that the code I call Kindeditor is introduced using Requirejs, The DOM structure is already complete when executing the Kindeditor.ready code, and the dynamically inserted script code does not trigger the Domcontentloaded event again, so the Kindeditor.ready registered callback will never be executed and the rich text box will certainly not appear. The solution is simple, do not use Kinkeditor.ready, direct kindeditor.create (). Just fine:

Kindeditor.create (' #editor_id ');

  

Kindeditor when used with Requirejs, ready fails

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.