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 9164869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:47:06+00:00 2026-06-17T14:47:06+00:00

I’m creating a website and on one page of the site (it’s .php) I

  • 0

I’m creating a website and on one page of the site (it’s .php) I have two links. The first reads register and the next reads login. I am using jquery to create a popup and which form pops up depend on the link clicked. (I am trying to do this but not able to). I have 2 files in total (logReg.php) and (popup.css).

When I click on login the login form pops up as expected, but when i click on register nothing pops up. And if I reverse these that if I put the jquery code for register first then… the register box pops up but the login doesn’t. I have read the click() function’s jquery API but it seems to me i’m doing everything right but obviously not. Any help would be greatly appreciated. BTW This code is not 100% mine I modified the code that I found for a single popup window.

Content of logReg.php

<html>
     <head>
          <!-- Typical stuff here. link to the popup.css & jquery.js -->
          <title>MyPage</title>
          <script type="text/javascript">
               $(document).ready(function () {
                    $("a.login-window").click(function () {

                         //Getting the variable's value from a link
                         var loginBox = $(this).attr("href");

                         //fade in the popup
                         $(loginBox).fadeIn(300);

                         //set the center alignment padding
                         var popMargTop = ($(loginBox).height() + 24) / 2;
                         var popMargLeft = ($(loginBox).width() + 24) / 2;

                         $(loginBox).css({
                              'margin-top' : -popMargTop,
                              'margin-left' : -popMargLeft
                         });

                         //Add the mask to body
                         $('body').append('<div id="mask"></div>');
                         $('mask').fadeIn(300);
                         return false;
                    });

                    //When clicking on the button close the pop closed
                    $('a.close, #mask').live('click', function() {
                         $('#mask, .login-popup').fadeOut(300, function() {
                              $('#mask').remove();
                         });
                         return false;
                    });

                    $("a.register-window").click(function () {

                         //Getting the variable's value from a link
                         var registerBox = $(this).attr("href");

                         //fade in the popup
                         $(registerBox).fadeIn(300);

                         //set the center alignment padding
                         var popMargTop = ($(registerBox).height() + 24) / 2;
                         var popMargLeft = ($(registerBox).width() + 24) / 2;

                         $(registerBox).css({
                              'margin-top' : -popMargTop,
                              'margin-left' : -popMargLeft
                         });

                         //Add the mask to body
                         $('body').append('<div id="mask"></div>');
                         $('mask').fadeIn(300);
                         return false;
                    });

                    //When clicking on the button close the pop closed
                    $('a.close, #mask').live('click', function() {
                         $('#mask, .register-popup').fadeOut(300, function() {
                              $('#mask').remove();
                         });
                         return false;
                    });
               });
          </script>
     </head>
     <body>
          <div id="links>
               <a href="#login-box" class="login-window">Login</a>
               <a href="#register-box" class="register-window">Register</a>
          </div>
          <div id="login-box" class="login-popup">
               <form method="post" class="signin" action="">
                    <!-- All form stuff here -->
               </form>
          </div>
          <div id="#register-box" class="register-popup">
               <form method="post" class="signin" action="">
                    <!-- All form stuff here -->
               </form>
          </div>
     </body>
</html>
  • 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-17T14:47:08+00:00Added an answer on June 17, 2026 at 2:47 pm
    • first don’t use .live, upgrade jquery and use

      $(document.body).on({event:function(){},...},"selector"
      
    • second don’t use append, use

      $('<div../>').appendTo($(document.body));
      

    (i believe your bug comes from second)

    also you could make a plugin of your open box code, then you bind the two at once using.on

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small

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.