У меня есть форма с текстовой областью, в которой я реализовал редактор WYSIWYG tinyMCE.Когда я нажимаю кнопку отправки, текст должен отображаться в консоли (для целей тестирования).Вместо этого он выводит пустым.Я что-то забыл?
<form>
<textarea id="forumreply" style="width:100%;margin-top:1rem;height:10rem;"></textarea>
<div id="replyerrbox" class="errboxtxt"></div>
<button id="forumreplysubbut" class="btn btn--orange">Send</button>
</form>
<script>
document.getElementById('forumreplysubbut').addEventListener('click',function(event){
event.preventDefault();
var err = new Array();
var reply = document.getElementById('forumreply');
var rpid = <?php echo $postId; ?>;
var errbox = document.getElementById('replyerrbox');
console.log(reply.value);
/*
if(reply.value.trim().length < 100){
err.push(1);
}
if(err.length != 0){
errbox.innerHTML = "Replies must be 100 characters in length.";
}else{
var dta = new FormData();
dta.append('reply',reply.value);
dta.append('rpid',rpid);
var req = new XMLHttpRequest();
req.onreadystatechange = function(){
reply.value = null;
getReplies();
}
req.open('POST','includes/processforumreply.php',true);
req.send(dta);
}*/
});
</script>
<script>
tinymce.init({ selector:'textarea',
branding:false,
menubar:false,
mobile:{theme:'mobile'},
plugins: 'emoticons',
toolbar: 'undo redo | bold italic | link emoticons' });
</script>