I have textarea
element. When a user types some HTML code inside the textarea
, the function should find the body
element.
The HTML code
<textarea id="textarea_code" ></textarea>
<a href="" onclick="check()">Check element</a>
The JavaScript function:
function check()
{
var codecheck = document.getElementById('teatarea_code').getElementsByTagName('body');
if(codecheck)
{
alert('Yes, textarea has body element.');
}
}