Probé summernote como un simple editor de html. Intenté incluir summernote de cdn como se muestra a continuación:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Creative</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <link href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"> <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <!-- include summernote css/js --> <link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.js"></script> </head> <body> <div class="summernote" id="summernote"></div> <input type="button" id="dwn-btn" value="Download"/> <script> $(document).ready(function () { $('#summernote').summernote({ height: 500, // set editor height minHeight: null, // set minimum height of editor maxHeight: null, // set maximum height of editor focus: true // set focus to editable area after initializing summernote }); function getCode() { var html = $('#summernote').summernote("code"); console.log(html); } document.getElementById("dwn-btn").addEventListener("click", getCode); }); </script> </body> </html>La inicialización de summernote funciona bien. Pero cuando se hace clic en el botón de descarga, dentro de la función getCode aparece un error como
TypeError no detectado: $(...).summernote no es una función
Mientras ejecuta esto como fragmento de código, funciona bien. El problema es simplemente crear un archivo html con el código anterior y ejecutarlo en el navegador, luego aparecerá el error en la consola. Por favor ayúdenme, estoy atascado por 2 días. Para cualquier ayuda gracias de antemano.