Readonly Toggle

0

All fields in a form come with readonly . I use the function below to remove the attribute from all inputs.

$('#form input').attr('readonly', false);

But I would like a way to do similar to toggle of jQuery
Each time the user interacts with a particular element, change the status of readonly .

Any suggestions?

    
asked by anonymous 09.02.2018 / 23:51

1 answer

0

[RESOLVED]

$("#form:input").each( function() {
   $(this).prop("readOnly",!$(this).prop("readOnly"));
});
    
10.02.2018 / 00:05