How to get tinymce editor value in jquery

How to get tinymce editor value in jquery

 

<textarea class="form-control" name="txt_content" id="txt_content"></textarea>

 

<script src="~/Scripts/tinymce/tinymce.js"></script>
<script>
    tinymce.init({
        selector: '#txt_content',
        width: 1200,
        height: 500,
        plugins: [
      'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker',
      'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
      'table codesample emoticons template paste help '
        ],
        codesample_languages: [
		{ text: 'HTML/XML', value: 'markup' },
		{ text: 'JavaScript', value: 'javascript' },
		{ text: 'CSS', value: 'css' },
		{ text: 'PHP', value: 'php' },
		{ text: 'Ruby', value: 'ruby' },
		{ text: 'Python', value: 'python' },
		{ text: 'Java', value: 'java' },
		{ text: 'C', value: 'c' },
		{ text: 'C#', value: 'csharp' },
		{ text: 'C++', value: 'cpp' },
        { text: 'SQL', value: 'sql' }
        ],
        toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify |' +
          ' bullist numlist outdent indent | link image | print preview media fullpage | ' +
          'forecolor backcolor emoticons | codesample | help',
        menu: {
            favs: { title: 'My Favorites', items: 'code visualaid | searchreplace | spellchecker | emoticons' }
        },
        menubar: 'favs file edit view insert format tools table help',
    });
</script>

 

var value = tinyMCE.get('txt_content').getContent();

2021-10-03