mercredi 2 mars 2016

How to check which background image div contains?

I have a div tag which can contain either 1 of the 3 images I have. Imagea, Imageb and ImageC as the background.

What I would like to do is write a if statement to check if background image the div contains.

var myDiv = document.getElementById("divtag1"); 
    if(myDiv == "url('images/plane.png')" ) {
        // Doing something
     }

This doesn't seem to work, any help is welcomed.

Aucun commentaire:

Enregistrer un commentaire