vendredi 25 mars 2016

Used the code in javascrpt there is no response from getElementById

Firstly used this same code with switch it worked but with if-else getElementById id not working.

 <html>  
    <head>
    <body>    
    <input id="myInput" type="text" value="Vegitablesss!!!!"> <br/>    
    <button onclick="checkVegi()">Check Vegitable</button> <br/>    
    <p id="ex4"></p> <br/>    
    <script>    
    function checkVegi() <br/>    
    {    
    var text=document.getElementById("myInput").value;<br/>    
    if(text=="Carrot")<br/>    
    {     
    document.getElementById("ex4").innerHTML = "Carrot is good!"; <br/>    
    }   
    }   
    </script>    
</body>   
</html>  

Aucun commentaire:

Enregistrer un commentaire