How do you get the pressed button in a button group from a function .
Thanks in advance,
1 Answer, 1 is accepted
answered on 28 Jan 2022, 07:17 AM
To achieve the targeted functionality, you can use the select event of the ButtonGroup and execute a logic similar to the below one, once the event is triggered:
var index = this.current().index();
var text = this.current().innerText;
/* The result can be observed in the DevTools(F12) console of the browser. */console.log(index);
The code in yellow will return the index of the pressed button inside the ButtonGroup and the code in green will return its text.
Here is a REPL example demonstrating the above implementation in UI for ASP.NET Core context. The same as the demonstrated implementation is valid in the UI for ASP.NET MVC.
I hope the above will help you achieve what you need in your project.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.