Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8465147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:57:32+00:00 2026-06-10T14:57:32+00:00

I am using the jQuery tabbed interface to switch between views of my Facebook

  • 0

I am using the jQuery tabbed interface to switch between views of my Facebook application using ajax. I have two tabs – tab1 and tab2 which both have buttons on them of the form .

The problem is that when I go to tab1 and click the buttons they do not work. If I then go to tab2 the buttons on that page work. If I then go back to tab1 the buttons work there. The same also happens in reverse: if I go to tab2 first and click the buttons they do not work, but if I go to tab1 they do work. Returning back to tab2, the buttons are now working.

Does anyone know why this might be happening?

EDIT: Below is a cut down version of the code for the page. The event handlers are currently in the header. I have already tried putting them at the bottom of the body as well though.

    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            <title>Profile Page</title>
            <link href="../css/profilepage_s.css" rel="stylesheet" type="text/css"/>
            <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
            <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/redmond/jquery-ui.css" rel="stylesheet" type="text/css" />

            <!-- Importing javascript configuration file and library of functions to call Facebook features -->
            <?php include('../../config_js.php'); ?>
            <script type="text/javascript" src="../js/facebookFeatures.js"></script>

             <!-- This is all jQuery code -->
            <script type="text/javascript">
                $(document).ready(function (e) {
                    <!-- Converts Link into button -->
                    //$("#thisIsAButton").button();


                    <!-- Updates the user's shortlist with id of this person -->
                    $("#updtShortlistBtn").click(function () {
                        alert("I'm in");

                        //$(this).hide();

                        $.get('../Scripts/updateShortlist.php', 'uid=<?php echo $uid?>&targ_id=<?php echo $targ_id?>');
                    }); 
                });
            </script>​​​

        </head>
        <body>

        <div id="container">

            <a id="thisIsAButton" href="../View/edit_profile.php">go to page 4</a>

            <?php //echo $targ_id ?>

            <!-- Displays the Profile Picture -->
            <div id="profile_pic">
                <img src="<?php echo $picture ?>"/>
            </div>

            <!-- Displays list of comparisons-->
            <div id="comparison"></div>
            <div id="bio"><?php //echo $bio ?></div>

            <!-- Show different views if user is viewing their own profile or another user's profile -->
            <!-- These features should only be available if the user is viewing their own profile -->
            <?php 

                if ($activeUsersProfile){ ?>
                    <!-- Edit Profile Button -->
                    <div id="editProfileBtn">
                        <button data-pagelink="../View/edit_profile.php">Edit Profile</button>
                    </div>

                    <!-- Button to publish a summary of user's app profile to their Facebook profile -->
                    <div id="publishBtn">
                        <input type="button" value="Publish Profile" onclick="publishToWall(<?php echo $targ_id ?>)"/>
                    </div>

            <?php } else { ?>

                            <!-- Displays Send Message Button and Update shortlist button -->
                    <div id="sndBtn">
                            <button type="button" id="updtShortlistBtn">Say 'Hey'!</button>
                    </div>  
<?php } ?>
            </div>
        </body>
    </html>

EDIT:

$(document).ready(function (e) {

                $(document).on('click', '#updtShortlistBtn', function () {

                alert("I'm in");
                 $.get('../Scripts/updateShortlist.php', 'uid=<?php echo $uid?>&targ_id=<?php echo $targ_id?>');
            });

            });

EDIT2: Sorry, while trying to shorten my example code I took out some buttons which did not have jQuery such as the one below. I realise now that this might be important to finding the solution!

// Calls a method in the facebookFeatures.js file linked at top
<button type="button" id="sndMessageBtn" onclick="sendMessage(<?php echo $targ_id ?>)">Send Message</button>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:57:33+00:00Added an answer on June 10, 2026 at 2:57 pm

    The events are being bound on document ready, so i’m assuming that maybe the buttons don’t exist then? You say the tab’s are loaded via ajax, so they do not (likely) exist at the time document ready fires.

    There is an event in the jQuery tab for load where you should put your click-binding

    http://jqueryui.com/demos/tabs/

    $('#tabs').tabs({
        load: function() {
            $("#updtShortlistBtn").click(function () { /* do Stuff */ });
        }
    });
    

    Alternatively, you could bind to the document with a delegated handler:

    $(document).on('click', '#updtShortlistBtn', function () {
        //do Stuff
    });
    

    This way it doesn’t matter when the button’s exist…the handler is bound to the document and event bubbling takes care of the issue

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery UI Tabs for a tabbed interface with panes that is
I have a tabbed panel created using the jquery ui tabs and where each
I'm coding a tabbed interface using jQuery and whilst it all works, functionality wise,
So, I created a tabbed interface using java script, jQuery, and CSS in which
I am using jquery tabs to load content from a remote file. I have
I have adapted a jQuery tabbed interface tutorial to create an interface for viewing
I am trying to control HTML5 videos using JQuery. I have two clips in
I have a tabbed jquery slider that I'm using to display elements of an
OK, so I have a tabbed interface which adds tabs dynamically once a link
I'm using a JQuery Tabbed Menu which holds different types of forms and when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.