I tried using the following code:
$('button[name^="X,Y,Z"]').on("click",function(){
// code here
});
to replace this code but it didn't work. Anybody has a work around to make it shorter :) without using class or ids
$('button[name^="X"],button[name^="Y"],button[name^="Z"]').on("click",function(){
// code here
});