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);
精彩评论