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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:59:40+00:00 2026-05-27T19:59:40+00:00

How can I put this two statements into one singel statement. They work something

  • 0

How can I put this two statements into one singel statement. They work something like in a mirror.
I am trying to make the code look better and simple.
Any help is very appreciated.

           $('#q_login_dialog #menu-register').click(function() {

                    $('#q_login_dialog #menu-login').removeClass('q_dialog_panel_item_active');
                    $('#q_login_dialog #menu-register').addClass('q_dialog_panel_item_active');
                    $('#q_dialog_login input[type!=hidden]').val('');
                    $('#q_dialog_reset input[type!=hidden]').val('');
                    $('#q_dialog_login').hide();    
                    $('#q_dialog_reset').hide();                                    
                    $('#q_dialog_register').show();
                    $('#q_dialog_register input[name=email]').focus();
                    $('#q_dialog_login input').blur();
                    $('#q_dialog_login span').html('');
                    what = 'register';                              
                });

            $('#q_login_dialog #menu-login').click(function() {

                    $('#q_login_dialog #menu-register').removeClass('q_dialog_panel_item_active');
                    $('#q_login_dialog #menu-login').addClass('q_dialog_panel_item_active');
                    $('#q_dialog_register input[type!=hidden]').val('');
                    $('#q_dialog_reset input[type!=hidden]').val('');   
                    $('#q_dialog_register').hide();
                    $('#q_dialog_reset').hide();                
                    $('#q_dialog_login').show();
                    $('#q_dialog_login input[name=email]').focus();
                    $('#q_dialog_register input').blur();
                    $('#q_dialog_register span').html('');  
                    what = 'login';                     
                });     
  • 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-05-27T19:59:41+00:00Added an answer on May 27, 2026 at 7:59 pm

    The only difference between the two seems to be the use of register vs. login, which should be fairly easy to parameterize:

    function makeClickHandler(type, subtype) {
        return function() {
            $('#q_login_dialog #menu-' + subtype)
                    .removeClass('q_dialog_panel_item_active');
            $(this).addClass('q_dialog_panel_item_active');
            $('#q_dialog_' + subtype + ' input[type!=hidden]').val('');
            $('#q_dialog_reset input[type!=hidden]').val('');
            $('#q_dialog_' + subtype).hide();   
            $('#q_dialog_reset').hide();                                   
            $('#q_dialog_' + type).show();
            $('#q_dialog_' + type + ' input[name=email]').focus();
            $('#q_dialog_' + subtype + 'input').blur();
            $('#q_dialog_' + subtype + 'span').html('');
            what = type;
        }
    }
    
    $('#q_login_dialog #menu-register').click(makeClickHandler("register", "login"));
    $('#q_login_dialog #menu-login').click(makeClickHandler("login", "register"));
    

    My eyes could be missing another difference, but I think that’s it (and, if not, you should see the general idea).

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

Sidebar

Related Questions

Is this functionality going to be put into a later Java version? Can someone
How can I construct my ajaxSend call, this seems like the place to put
I want to replace two things in one select statement. Now I can replace
If you have a string of 1,2,3,1,5,7 you can put this in an array
Maybe a very simple question. How can I put in this code <Query> <Where>
I'm developing this application where you can put text and drawings in a page.
I'm about to put my head thru this sliding glass door. I can't figure
I am trying to find out the right if statement to use for this
An index on two columns can be created with either of the statements create
I'm trying to construct a query that will map two columns, one, a date

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.