My Comments /g, ">"); s = s.replace(/ /g," "); s = s.replace(/\'/g, "'"); s = s.replace(/\"/g, """); return s; } $(function(){ $('.viewsource').bind('click',function(){ var $parentBox = $(this).parent(); var $html = $parentBox.clone(); $('.viewsource',$html).remove(); $.colorbox({title:"The Source Code",html:"