I have a unique custom div that has been modified to function as an input element. Inside this custom div input element, there is a <p>
tag with a default placeholder text. My goal is to verify whether the content of this div is empty or contains new text, similar to checking for a required property in a standard input element.
Upon submitting the form, I require JavaScript to validate whether the custom div element contains the default placeholder text or if it has been edited with new content.
This is the code I am currently using:
var data = $('#divtext').html();
if(data == '<p>Default place holder</p>')
{
console.log('empty');
}
else
{
console.log('notempty');
}
Despite submitting the div without any text, I always receive the 'notempty' response. I am puzzled by this behavior - can anyone assist me in understanding why?