I have made the coding of javascript validation for editor(i am using ckeditor).It is not working properly.i.e when i am going to submit the form at first the alert box is coming as the editor is empty but when i am adding some content and going to validate it ,still the alert box is coming.After it everything goes fine.But i want that the alert box will come once ,when the editor field is empty.So please suggest me.Below is my coding.Thank you.
<script type="text/JavaScript">
function validate()
{
var descrip = document.getElementById("description").value;
if(descrip == "") {
alert("Please Enter partner description");
document.getElementById("description").focus();
document.getElementById("description").style.borderColor="#fd00d6";
return false;
}
}
</script>
<script src="ckeditor/ckeditor.js"></script>
<form role="form" action="" method="post" enctype="multipart/form-data" onsubmit="return validate();">
<div class="box-body">
<div class="form-group">
<label for="exampleInputEmail1">Partner Description</label>
<textarea id="description" name="description" rows="10" cols="80" class="ckeditor" ><?php echo $_REQUEST['description']; ?> </textarea>
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-primary" name="add_partner">Submit</button>
</div>
</form>