Change Dropdown Selection to Enable Disable Textarea Using jQuery – Code Snippet #26

28 Feb , 2014  Code Snippets 

Enable-Disable-Text-Area-Using-jQueryCode Snippet #26: The code we see today enables and disables text area with dropdown selection using jQuery. In short we going to enable disable textarea using jQuery. 

With jQuery we can achieve anything on the web scripting side. Using jQuery, controlling the textarea is something necessary when a form is in place on your website. In some of our previous code snippets, we have seen similar tutorials like:

We have not touched upon enabling and disabling text area and hence this code snippet. Hope you will enjoy.

DEMO: [Change the drop down to see the textarea enable and disable]

HTML:

jQuery:

Explanation:

We create a simple drop down selection with options having enable and disable. The disable has the value “1” and enable has the value “2”. We then create a textarea and show it next to the drop down.

When the user changes the drop down, the change event is initiated. This is checked in jQuery script. When the drop down selected value equals 2 then the textarea is disabled else it is not enabled. As simple as that.

Hope you found this code snippet useful. We will post more code-snippets. If you have any queries, please let us know by commenting.



, ,

Comments are closed.