Value of field where ckeditor is used not available

Dear Respected ,

I am using a text field (textarea) with ckeditor say “detail”

on submit i am checking whether field “detail” is empty or not using javascript or jquery .

I had enter “test test” in this field

when i click submit

i found this field empty. (getting no value for this field)

however , when i click again i can get value of this field

i donot understand this

and

how toget the value when i click submit for 1st time

if you need help, you will need to share a link to your code (say in a gist or on codepen.io or in github) to start with.

I got solution with search stack over flow

var detail1=$.trim(CKEDITOR.instances.detail.getData()); // this is main part
console.log(’ detail1 ‘+detail1+’')
if ((detail1 ==“”) || (detail1 ==“NULL”) || (detail1 ==" “))
{
alertMsg += " - Detail \n”;
}

thanks a lot