$(window).ready(function () { $('#board-toppic').validator().on('submit', function (e) { var alleditDetail = CKEDITOR.instances.comment.getData(); if (!alleditDetail) { $('#comment').parent('.input-group').parent('.form-group').addClass("has-error has-danger"); CKEDITOR.instances.comment.focus(); return false; } else { $('#comment').parent('.input-group').parent('.form-group').removeClass("has-error has-danger"); $('#comment').parent('.input-group').parent('.form-group').addClass("has-success"); } }); $('#board-reply').validator().on('submit', function (e) { var alleditDetail = CKEDITOR.instances.comment.getData(); if (!alleditDetail) { $('#comment').parent('.input-group').parent('.form-group').addClass("has-error has-danger"); CKEDITOR.instances.comment.focus(); return false; } else { $('#comment').parent('.input-group').parent('.form-group').removeClass("has-error has-danger"); $('#comment').parent('.input-group').parent('.form-group').addClass("has-success"); } }); });