Domanda

Ok so I have a function set up already and it gets added in the div as numbers and letters

"var elCamLocation = $( "TEST" )"

Right! Now I want to use a function to keep track on what is in the innerHTML of the "TEST" div and if the contents of the div changes to "0.00x2.00z0.00" then I want it to do something for example lets just say change url to keep it simple.

Here is what I have..

var Numbs = getElementById("TEST").innerHTML;

    function TE()
    {

    if(Numbs = "0.00x2.00z0.00")
    {
    window.location.assign("http://google.com")
    }


    };

But it isn't working the window.location.assign("http://google.com")isn't triggering at all any idea's?

È stato utile?

Soluzione

= is for assignment. You should test for equality using the === operator.

if(Numbs === "0.00x2.00z0.00")
{
    //etc.
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top