JSFiddle - React, Tailwind, and code Playground
HTML
<label for="position"><b>Position:</b></label><br/><br/>
<input type="radio" name="position" id="r1" value="Dean" onclick="Checkradiobutton()"/>Dean
<input type="radio" name="position" id="r2" value="Instructor" onclick="Checkradiobutton()"/>Instructor
<input type="radio" name="position" id="r3" value="Student" onclick="Checkradiobutton()"/>Student<br/><br/>
<input type="radio" name="position" id ="r4" value="<?php echo $_POST['otherPosition']?>" onclick="Checkradiobutton()"/>
Others:
<input type="text" value = "<?php if($error==TRUE){echo $_POST['otherPosition'];}?>" id="otherPosition" placeholder="Specify" name="position" />
CSS
.field-name
{
color: #444;
font-family: verdana;
font-size: 0.85em;
line-height: 2em;
}
JavaScript
function Checkradiobutton()
{
if(document.getElementById('r1').checked || document.getElementById('r2').checked || document.getElementById('r3').checked)
{
document.getElementById('otherPosition').disabled=true;
}else{
document.getElementById('otherPosition').disabled = false;
}
}