Ajax tab not executing script

Ajax tab not executing script

I am using JQuery UI tabs to load content through Ajax. I have two tabs that is loading the remote page. Remote page contains html content and script. When tabs are clicked remote content are loaded correctly in the tab content. Script in the remote content executed correctly on document ready function. Second tab is also loading same remote page correctly. But the script in second remote content not executing. Script also register click event on a button that was also not firing. In first tab remote load executing everything perfectly. I have problem only in second tab remote content. 

Could you help me here?

I have code snippet here to reproduce the problem.

Here is the HTML page has tab listing

  • Tab Index Page
    1. <html lang="en">
    2. <head>
    3.     <meta charset="utf-8">
    4.     <title>tabs demo</title>
    5.     <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    6.     <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    7.     <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    8. </head>
    9. <body>
    10. <div id="tabs">
    11.     <ul>
    12.         <li><a href="tabContent.html"><span>One</span></a></li>
    13.         <li><a href="tabContent.html"><span>Two</span></a></li>
    14.     </ul>
    15. </div>
    16. <script>
    17. $("#tabs").tabs();
    18. </script>

    19. </body>
    20. </html>


    Remote Content Page

    1. <script>
    2. $(document).ready(function () {
    3.     $("#HideShowMe").attr("disabled", true);
    4.     $("#HideShowMe").hide();

    5.     $('#Cancel').click(function () {
    6.         $('#HideShowMe').attr('disabled', true);
    7.         $('#HideShowMe').hide();
    8.     });

    9.     $('#Show').click(function () {
    10.         $('#HideShowMe').attr('disabled', false);
    11.         $('#HideShowMe').show();
    12.     });

    13. });
    14. </script>

    15. <h2>Ajxified Content</h2>
    16. <div id="ActionHideShow">
    17. <input type="button" id="Cancel" name="command" value="Cancel" />
    18. <input type="button" id="Show" name="Show" value="Show" />
    19. </div>

    20. <div id="HideShowMe">
    21. <p>Hello there I should hide at any cost</p>
    22. </div>