vendredi 20 octobre 2017

Checkbox returns true even when unchecked

I am having trouble with an if-statement. In this statement i want to check if a checkbox is checked true (or isSelected) then it shall proceed with the instruction to disable a textarea. This part is working fine. But unfortunately if the checkbox is unchecked it still disabling the textarea, but it shouldn't. It should leave the textarea enabled.

function auswahl_bestaetigen(){

    tweet = document.getElementById("chk_tweet")
    twitter = document.getElementById("twitter")

    if (tweet.isSelected = true)
                twitter.disabled = true
    else if (tweet.isSelected = false) 
                twitter.disabled = false    
}

i hope someone can help me with this problem. Thanks in advance :)




Aucun commentaire:

Enregistrer un commentaire