'I am using WYSIWYG text editor I need to get the value of a textarea in jQuery. I have tried without WYSIWYG then I abled to get the value

I need to get the value of the textarea but I cannot get the value using the WYSIWYG text editor. I got the value without WYSIWYG text editor but I need the value in WYSIWYG text area. How can I fix this?


 <!--Jquery CDN-->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--WYSIWYG Texteditor CDN-->
    <script src="https://cdn.tiny.cloud/1/142v261jlrz3ntk7kklzqfs5hzmv2lhvw3ln73zsq66ln2pr/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>

<form th:action="@{/answerSave}" method="post"th:object="${answer}">

<textarea id="comment" name="comment" th:field="*{fullAnswer}"> </textarea><br>
<button id="previewAnswers" class="btn btn-success" onclick="answerQuestionMappping()">Submit Answer</button> 
</form>

This is my javascript part


 function answerQuestionMappping(){

   var answerComment = $("#comment").val();

   console.log(answerComment);
   alert(answerComment);
 
 }


Solution 1:[1]

Solved.

views.py

class srrpListView(ListView):
    template_name = 'srrp/srrplist.html'
    paginate_by = 10 
    
    def get_queryset(self):
        modelname = self.kwargs['modelname']
        ctype = ContentType.objects.get(app_label='srrp', model=modelname)
        model = ctype.model_class()
        return model.objects.all()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pandaeyes