Make textarea readonly with jquery

前端 未结 6 1726
醉梦人生
醉梦人生 2020-12-14 00:28

For text input I do:

$(\'input[type=\"text\"]\').each(function(){
  $(this).attr(\'readonly\',\'readonly\');
});

But what shou

6条回答
  •  Happy的楠姐
    2020-12-14 01:07

    From Jquery 1.6 use

    $("#mytxtarea").prop("disabled", true);
    

    Visit http://api.jquery.com/prop/

提交回复
热议问题