How can radiobutton change textbox'state (enable or disable) ?

I have a question about radiobutton.I can do it with pure jquery but i want to ask....Is there a radiobutton's property that change make another input's state enable or disable ?


3 Replies

SD Saranya Dhayalan Syncfusion Team February 19, 2020 08:43 AM UTC

Hi Tümer, 
 
Thank you for contacting Syncfusion support 
 
We have checked your reported query, we can achieve this in radio button change event. In change event we can set true/false to set the enable /disable property for textbox component. Please find the below code snippet: 
 
Index.cshtml 
<div class="row"> 
    <ejs-radiobutton id="radio1" label="Enable" name="payment" value="enable" checked="true" change="onChange"></ejs-radiobutton> 
</div> 
<div class="row"> 
    <ejs-radiobutton id="radio2" label="Disable" name="payment" value="disable" change="onChange"></ejs-radiobutton> 
</div> 
 
<div class="control-section"> 
    <ejs-textbox id="firstname" placeholder="First Name"></ejs-textbox> 
</div> 
 
<script> 
  
    function onChange(args) { 
        var textboxObj = ej.base.getComponent(document.getElementById('firstname'), 'textbox'); 
        if (args.value == "disable") { 
            textboxObj.enabled = false; 
        } 
        else if (args.value == "enable") { 
            textboxObj.enabled = true; 
        } 
    } 
</script> 
 
 
 
 
 
Could you please check the above code snippet and get ack to us if you need further assistance on this? 
 
Regards, 
Saranya D 



Tümer February 20, 2020 10:20 AM UTC

Hi Saranya,

Thanks for your response and sample code. That's what i exactly looking for.

Bests,
Tümer


SD Saranya Dhayalan Syncfusion Team February 20, 2020 11:13 AM UTC

Hi Tümer 
 
Most Welcome.  
 
Please let us know, if you need any further assistance on this.  
 
Regards, 
Saranya D 


Loader.
Up arrow icon