Make textarea readonly with jquery

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

For text input I do:

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

But what shou

6条回答
  •  孤城傲影
    2020-12-14 00:54

    You can write

    $("textarea").attr("readonly", "readonly");
    

    this will make readonly to all textarea fields.

提交回复
热议问题