No! That will fail -- and leave the field editable -- if JavaScript is turned off.
In general, there is almost never a good reason to use a read-only field. If the data is not editable, just put it on the page as plain text.
If there's some other issue, please explain in more detail.
Best,