Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use jQuery to disable a textarea + Submit button?

After a user submits a comment, I want the textarea and summit button to be "disabled" and somewhat visually disabled.

Like Youtube.

How can I do that with Jquery using the simplest plugin and/or method?

like image 326
TIMEX Avatar asked Dec 16 '10 22:12

TIMEX


1 Answers

Simply set the disabled attribute on your input elements when the button is clicked:

$("#mybutton").click(function(){
   $("#mytext,#mybutton").attr("disabled","disabled"); 
});

Example: http://jsfiddle.net/jonathon/JcXjG/

like image 75
Jonathon Bolster Avatar answered Oct 02 '22 16:10

Jonathon Bolster