Readonly Toggle

Asked

Viewed 62 times

0

All fields of 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 to do something similar to toggle of jQuery
Each time the user interacts with a particular element, change the status of the readonly.

Any suggestions?

1 answer

0


[RESOLVED]

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.