How to disable and enable an input field using jQuery?
Hello everyone! I've just started learning jQuery and came across a seemingly simple task: I need to dynamically disable and enable an input field on a form depending on user selection.
I have a registration form. It has a checkbox "I agree to the terms" and a promo code input field. I want the promo code field to be disabled until the user checks the checkbox. Once the checkbox is checked, the field should become enabled, and vice versa.
Here is my current code:
```html
I agree to the terms
``` And my jQuery code: ```javascript $(document).ready(function() { $('#agreeCheckbox').on('change', function() {
``` And my jQuery code: ```javascript $(document).ready(function() { $('#agreeCheckbox').on('change', function() {