JSFiddle - React, Tailwind, and code Playground

HTML

<input id="test" type="text" value="text" />

JavaScript

$("#test").attr("readonly", true);