开发者

Add click event on disabled textarea (jquery + ui) [duplicate]

开发者 https://www.devze.com 2023-04-01 04:01 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Jquery event on a disabled input
This question already has answers here: Closed 11 years ago.

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);
});
0

精彩评论

暂无评论...
验证码 换一张
取 消