Possible Duplicate:
Jquery event on a disabled input
I am making an edit dialog for a device. The devi开发者_JS百科ce has a comment-field in the database. This comment-field only has to be editable when the textarea representing it is not disabled.
I know by trial and error that
$("#textarea").click(function(){
// textarea will be enabled here
});
Doesn't work, since the textarea is disabled... is there a way around this or another way to add a click event to a disabled element?
EDIT:
James link worked. Event on a disabled input
One problem though. IE don't support position absolute on divs when are empty. If i fill the div with a color in CSS it displays, but if i don't and just set the top,bottom,left,right and position it wont't show.. anyone know a fix fore this? (im fine with it only working in FF for now)
thanks again
you can make the text area readonly instead of disabled. it will have the same effect and will be clickable.
<textarea readonly=true>
aaa
</textarea>
$("textarea").click(function(){
alert(123);
});
精彩评论