looking at the code you posted above, if you replace the content exactly, including the onclick handlers, it should work. However, .html does not get the onclick attributes, therefore they are never rebound. I recommend
against using inline javascript such as onclick="method();"
- $(document).ready(function(){
- function setupHandlers() {
- $('#myContent a:contains(Open color box)').click(function(){
- openColorBox();
- return false;
- });
- $('#myContent a:contains(Sent ajax request)').click(function(){
- submitAjax();
- return false;
- });
- }
- function openColorBox() {
- $.fn.colorbox({href:"popup.html"});
- }
- function submitAjax() {
- $('body').html($('body').html());
- setupHandlers();
- }
- setupHandlers();
- });
and remove the onclick="" methods