We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Event on Radio button selection

Hi, Following link shows how to create button group for single selection.
https://ej2.syncfusion.com/javascript/demos/#/fabric/button/button-group.html

However, there is no API or method for onclick event of radio button selection.
Can you pls share some sample for on click event for button group

1 Reply

SD Saranya Dhayalan Syncfusion Team October 16, 2019 11:55 AM UTC

 Hi Saravanan, 

Thank you for contacting Syncfusion support. 

We have checked your query and it can be achieved by using JavaScript “onclick” event for an input element. We have created simple sample based on your scenario. Please refer the below code snippet and sample link. 

HTML 
<p class="h5">Radio selection</p> 
<div id="text" class="e-btn-group"> 
    <input type="radio" id="left" name="align" value="left"> 
    <label class="e-btn" for="left">Left</label> 
    <input type="radio" id="center" name="align" value="center"> 
    <label class="e-btn" for="center">Center</label> 
    <input type="radio" id="right" name="align" value="right"> 
    <label class="e-btn" for="right">Right</label> 
</div> 
 
 
JAVASCRIPT 
 
document.getElementById('left').onclick = function () { 
  console.log('You clicked left radio button'); 
} 
document.getElementById('center').onclick = function () { 
  console.log('You clicked center radio button'); 
} 
document.getElementById('right').onclick = function () { 
  console.log('You clicked right radio button'); 
} 
 
 
 
Sample link: 
 
Could you please check the above sample and get back to us If you need further assistance on this? 

Regards, 
Saranya D 
 



Loader.
Live Chat Icon For mobile
Up arrow icon