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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:16:32+00:00 2026-05-23T13:16:32+00:00

Yesterday I had to go back to a page I had worked on a

  • 0

Yesterday I had to go back to a page I had worked on a few weeks ago to redo the UI. The UI consisted of a jQuery UI tab control with 3 tabs. Each tab had 3-5 controls inside of it, and a submit button to only submit the data within the tab. I had to reorganize some of the tabs, remove some textboxes, add some drop down lists, modify some behaviors and even work a bit on the client side validation (which uses jQuery Validation). What I found during this excercise, thought, was that I had to go back and recheck each and every one of my jQuery selectors. Some were left intact, but many of them changed.

I’m wondering what design pattern (if any) do people use to avoid or minimize the effect of refactoring or reworking a webpage that had heavy jQuery usage. I’m sure it can’t be just “Search” + “Search And Replace”.

  • 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-23T13:16:32+00:00Added an answer on May 23, 2026 at 1:16 pm

    It’s in general a very good idea to store node references commonly used. This could be done in some kind of “init script file” or in each “module” if you have modules separated by files.

    For instance

    var myNamespace = window.myNamespace || { };
    
    $(document).ready(function() {
        myNamespace.nodes = {
            header:   $('#header'),
            content:  $('#overlay > .content'),
            footer:   $('#footer')
        };
    });
    

    somewhere else in your code you should only access elements over such a hash lookup. Later if selectors change, you only need to replace / modify the selector strings in one place and all the rest keeps working.

    // somefile.js
    var myNamespace = window.myNamespace || { },
        myNodes = myNamespace.nodes;
    
    $(document).ready(function() {
        if( myNodes ) {
            myNodes.content.animate({ top: '+=200px' }, 1000);
        }
        else {
            throw new Error('Arrrrrrr the <center> cannot hold! it is too late');
        }
    });
    

    That concept also provides a better performance for your whole webapp. By quering nodes only once, since this is still a pretty expensive DOM operation.

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

Sidebar

Related Questions

Yesterday I had a few problems but I will explain it better here is
Yesterday I had a few question about OO and classes in PHP here but
Yesterday I had problems with some jQuery script. I did some research and realized
Yesterday i had a question in an interview which i thought i could find
Yesterday I had seen question concerning how to get file space information. I tried
Up until yesterday I had a perfectly working app on my iPhone. I made
Seems like just yesterday I had this same problem with Play! v1. After trying
In an programming interview I had yesterday, one of the programs I had to
This question has two parts. Part 1. Yesterday I had some code which would
We had a terrible problem/experience yesterday when trying to swap our staging <--> production

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.