jeudi 18 juin 2020

Text box Id is not getting validated by document.getElementById()

I have written a JS function in .jsp file to enable textbox when checkBox is checked. But the document.getElementById() is simply not working. If I put alert(document.getElementById("textBoxId"));,it returns null. Here is my code.

 function enableColumns() 
{

        if (checkBoxId.checked == true)
    {

        document.getElementById("column1Id").disabled = false;
        document.getElementById("column2Id").disabled = false;
    }
}

Also I have tried other methods like setAttribute, removeAttribute, window.onload for the same. Nothing is working. Please guide me in the above problem.




Aucun commentaire:

Enregistrer un commentaire