Is it possible to test in javascript if var contains an image node and if it is loaded?

I’m passing Node selections from function to function or function to Object and I’d like to check a few things in from the parameters of the second one.

I think I should check for it to be a Node, then the property tagName to be set to IMG but the loaded seems to be more dificult, as it is an image coming from the site and may or may not be loaded.

function is_tag_img_loaded (img) {
    if(img.tagname == "IMG" && img.loadended){
        return true;
    }else{ return false; }
}


Source: javascript

Leave a Reply