If you are using the contenteditable attribute for your WYSIWYG editor, or you are using JavaScript/JQuery code so the tags are inserted into the page (because it is WYSIWYG I think you do one of the mentioned) it seems to be a really trivial question and I will redirect you to the JQuery API selectors documentation http://api.jquery.com/category/selectors/ to catch your tags and the events doc to hook on the good event http://api.jquery.com/category/events/ http://api.jquery.com/click/
If your problem is more complicated and you think it can't be solved with those suggestions, please add some more informations.
Edit : Actual solution because op's editor is using execCommand
When the user release the mouse button on the text you are watching (release so it will be triggered when click and when he ended a selection), you test if one of the execCommand has been executed on the selection.
In the toggle, you manually trigger this function so the button will be actualised.
For more informations about the possible commands :
http://msdn.microsoft.com/en-us/library/ms536679%28v=vs.85%29.aspx
https://developer.mozilla.org/fr/docs/Rich-Text_Editing_in_Mozilla#Example.3A_a_simple_but_complete_Rich_Text_Editor
$('div.editable').mouseup(function() {
if(document.queryCommandState('bold')){
$('#toolbox #bold').wrap('<b></b>');
} else {
if($('#toolbox #bold').parent().is('b')) {
$('#toolbox #bold').unwrap();
}
}
});
function ToggleBold() {
document.execCommand('bold',null,false);
$('#colorpalette').fadeOut('fast');
$('div.editable').trigger('mouseup');
}