There is a mask that is set by input when the page loads.

$phone.mask("0299999999", {string: '{{ form_label(form.phone) }}'}) 

After sending the data, an attribute is put to this input.

 $phone.attr('readonly',true); 

Why is it possible to see that readonly = 'readonly' in the console by looking through the input code and you can still edit the field?

    1 answer 1

    Because the readonly attribute is checked by the browser only at the stage of building the DOM. When the DOM is already built, the corresponding property should be used instead of the attribute:

     $phone.prop('readonly', true); 
    • thus, only readonly attribute is written to the tag, rather than when attr is written and readonly = 'readonly'. And also does not work - Stein_