Conditionally Render Textbox on Selection of a Radio Button in Visualforce Page

Controller:

public class Sample{
    
    public String selectedOption { get; set; }
    
    public Sample()
    {
        selectedOption = 'No';
    }
}

Visualforce Page:

<apex:page controller="Sample">
    <apex:form id="form">
        <apex:selectRadio value="{!selectedOption}">
            <apex:actionSupport event="onchange" rerender="form" />
            <apex:selectOption itemValue="Yes" itemLabel="Yes" />
            <apex:selectOption itemValue="No" itemLabel="No" />
        </apex:selectRadio>
        <apex:inputText rendered="{!selectedOption='Yes'}" />
    </apex:form>
</apex:page>

Output: