开发者

Change all inputs with readonly attribute to disabled instead using jQuery

I'm having trouble with my jQuery syntax. Could someone show me how to iterate through all controls on a form that have the readonly attribute, remove the readonly attribute, and make then disabled instead? T开发者_Go百科hank you.


$('input[readonly="readonly"]').removeAttr("readonly").prop("disabled",true);


 $("#formID").each('input[readonly="readonly"]', function () {                
       $(this).removeAttr("readonly");
       $(this).attr("disabled", true);
 });

Not sure if you are doing this on page load, or on a link/button click, but this is a start.


$('#your_form_id [readonly]').removeAttr("readonly").prop("disabled",true);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜