Hi Rewati,
Ugur is saying correct , you need to use segmented buttons for this case which will be fast and better solution to your problem.
you can even do this on the normal button by applying style css classes to the active buttons and toggle the classes means add and remove the style classes.
Thanks
Viplove