The ReadOnly attribute in JS is rather strange. Directly creating an object and assigning the readonly attribute to the object cannot be done in the same way as in HTML:
Copy the code code as follows:
var x=document.createElement("input");
x.type="text";
x.value="ttttt";
x.id="xy";
x.readonly="readonly";
Objects created in this way are not read-only. The correct way to write it is:
Copy the code code as follows:
var x=document.createElement("input");
x.type="text";
x.value="ttttt";
x.id="xy";
x.readOnly=true;
You should pay attention to this when writing JS.