forgive me if it's not the proper topic. i'm new comer.
i have a small question.
in the above image, how i can bound my last input box to the check box? i mean when i checked it, the input box enabled get true and reverse.
thank you in advance.
Moderator: General Moderators
Code: Select all
<input type="checkbox" id="checkCourse" ... />
... <input type="text" id="textCourse" disabled="disabled" ... />Code: Select all
var fn = function () {
document.getElementById('textCourse').disabled = this.checked;
};
document.getElementById('checkCourse').onchange = fn;
document.getElementById('checkCourse').onclick = fn; //onclick needed for IE, because 'change' event is only fired when input looses focus