How To Know If An Object Is An Html Document Using Javascript
I'm passing an object say, obj, to a function. obj could possibly of any type - (TemplatedHelper, AlertMessage, PartialViews, HTMLDocument, etc.) I want to know if obj is an HTML D
Solution 1:
Try this:
if (obj instanceofHTMLDocument)
{
// obj is a HTMLDocument
}
if (Object.prototype.toString.call(obj) == "[object HTMLDocument]")
{
// obj is a HTMLDocument
}
Solution 2:
You can try this
$obj.is('html')
Post a Comment for "How To Know If An Object Is An Html Document Using Javascript"