Cannot .removeClass using $(this).next() – jQuery

The problem seems to be that you are trying to use .val() on the div, but it needs to be .text().

You can use var $val = $(this).val() || $(this).text(); it will detect if it will be .val() or .text()


$(document).ready(function() {

$('.mandatory').on('input change', checkInput)

function checkInput() {
  $('.mandatory').each(function() {
    var $val = $(this).val() || $(this).text()
    if ($val == '') {
    } else {
<script src=""></script>
<div class="form-group">

<p class="lead emoji-picker-container"></p>

<textarea name="title" id="title" class="form-control mandatory" rows="3" placeholder="Type your answer here" data-emojiable="converted" data-emoji-input="unicode" style="height: 100px; display: none;" data-id="e4914124-a85d-4ff4-96d7-9bfd0fd5a1df" data-type="original-input"></textarea>

<div class="emoji-wysiwyg-editor form-control mandatory" data-id="e4914124-a85d-4ff4-96d7-9bfd0fd5a1df" data-type="input" placeholder="Type your answer here" contenteditable="true" style="height: 100px;" spellcheck="false"></div>


CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top