JSFiddle - React, Tailwind, and code Playground

by Sourav Chatterjee

HTML

<button class="enable">Enable</button>

<button class="disable">Disable</button>

<input type="text" id="TextBoxID">

JavaScript

$('.enable').click(function(){
document.getElementById('TextBoxID').readOnly = true;    //to enable readonly
});

$('.disable').click(function(){
document.getElementById('TextBoxID').readOnly = false; 
});