Getting html from editor does not work | trumbowyg is not a function
See original GitHub issueDescription
System information
OS: Windows 10 Browser: Opera Trumbowyg Version: v2.18.0
Expected behavior
I want to get html from editor and POST the result with an AJAX request if onClick event occurs.
The following code is defined to achieve this goal:
$(document).ready(function(){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': "{{ csrf_token() }}"
}
});
$(document).on('click', '#save', function(){
var htmlDoc = $('#editor').trumbowyg('html');
$.ajax({
method: 'POST',
url: '/user/documents/{{$document->id}}/edit',
data: {
created_doc : htmlDoc,
},
success: function(response){
console.log(response);
},
error: function(jqXHR, textStatus, errorThrown){
console.log(JSON.stringify(jqXHR));
console.log("AJAX error: " + textStatus + + ' : ' + errorThrown);
}
});
});
});
Error which occurs
When firing the event up the following error is shown in the console:
Uncaught TypeError: $(...).trumbowyg is not a function
at HTMLAnchorElement.<anonymous> (edit:345)
at HTMLDocument.dispatch (jquery.min.js:3)
at HTMLDocument.q.handle (jquery.min.js:3)
How to reproduce?
Unfortunately it is not possible to provide a live-link to this project, but you should be able to represent the behavior with the provided code above.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Trumbowyg is not a function | Javascript Error - Stack Overflow
Solution was adding $.noConflict(); to the first line after the definition of the function inside of the document ready call.
Read more >Uncaught TypeError: $(...).trumbowyg is not a function
Hi there, I am trying to add an editor to my page and I am getting the following error: startup.js:7Uncaught TypeError: $(...).trumbowyg is ......
Read more >Error: Is not a function - Laracasts
Hey guys, I am using trumbowyg to deliver a richtext-editor on my website, to save changes I´ve implemented a function to observe the...
Read more >Documentation | Trumbowyg: A lightweight WYSIWYG editor
Trumbowyg is a jQuery plugin for create WYSIWYG editor. ... If your problem is not solved by these tips, check the SVG icons...
Read more >Top Trumbowyg Alternatives in 2022 - Slashdot
Compare ratings, reviews, pricing, and features of Trumbowyg alternatives in 2022. ... HTML-NOTEPAD does not function as a "webpage editor". It is not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solution was adding
$.noConflict();
to the first line after the definition of the function inside document ready.I initialized the editor outside of the document ready function, cause inside of the function I am getting the error that trumbowyg is not a function.
An editor element is defined, cause it shows me trumbowyg, just the event do not work!
I´ve defined it in the way you explained above, here is my code-snippet (which does not work!!!)