Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get .click() to work on a disabled textarea

I'm using jQuery. I have a disabled textarea: <textarea id="textarea" disabled="disabled"></textarea>. I want to make it so that when a user clicks on the textarea, it will do something, such as an alert box. So, I have $('#textarea').click(function() { alert('Test'); });.

However, this only works when the textarea is not disabled. So, how can I make the click event fire even when the textarea is disabled?

like image 525
Gary Avatar asked Dec 01 '22 21:12

Gary


1 Answers

instead of disabled="disabled" why not use readonly, readyonly is alomst same as disabled and the click event will works

like image 54
mgraph Avatar answered Dec 04 '22 11:12

mgraph