[Note: Please refer to the improved and revised version below, which does not need to use Chrome to find the object id]
Here's a trick to change the custom button color and icon. Eg. a button to turn on and off "Call Recording".
When button is clicked, the Server Event will update database table, eg. set the field to 1 (On) or 0 (Off);
The client After event will then change the color and icon of the Call Recording Button.
To do so, open the developer tool on Chrome, and click the button, then on the right panel, locate the id of the button.

Add the events to the button Tri-Part Events as follows:
Server Event:
// Do your database query and set is_recording variable and pass it to the After Client Event.
$strSQL = "SELECT is_recording from accounts WHERE id = ".$_SESSION["user_id"];
$rs = DB::Query($strSQL);
DB::Exec($strSQL);
while( $data = $rs->fetchAssoc() )
{
$result["is_recording"] = $data["is_recording"];
}
Client After Event:
var is_recording = result["is_recording"];
if (is_recording == 0)
{
var button_label =" Call Record On";
$("span[data-itemid=is_recording_button]").find("a").text(button_label);
$("#Recording_Button_7").removeClass('btn btn-danger fa fa-remove').addClass('btn btn-success fa fa-music');
}
else
{
var button_label =" Call Record Off";
$("span[data-itemid=is_recording_button]").find("a").text(button_label);
$("#Recording_Button_7").removeClass('btn btn-success fa fa-music').addClass('btn btn-danger fa fa-remove');
}
ACP