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

  • Home
  • SEARCH
  • 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 726789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:29:31+00:00 2026-05-14T06:29:31+00:00

Is it appropriate to create jQuery plugins which are specific to a single page?

  • 0

Is it appropriate to create jQuery plugins which are specific to a single page? I’ve been creating generic plugins that are not tied to any context and contain no business logic, but some people I’ve talked to suggest that almost all javascript, including business logic and logic specific to a single page, should be inside of jQuery plugins.

Is it appropriate to have a validateformXYZ plugin which validates a specific HTML form?

I’m buying into jQuery 100% but am not sure if this is a misuse or not.

  • 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-14T06:29:31+00:00Added an answer on May 14, 2026 at 6:29 am

    I tend to use a different approach to this. When I have objects (forms, usually) that need to have a lot of client-side behavior bound to them, I define JavaScript objects that represent those forms.

    For example, a contact form might have a corresponding Contact object that gets initialized with the context of the inner-form elements (textboxes, buttons, etc.) During initialization you can then use jQuery (or your framework of choice) to add behaviors to these elements. In your case you’d bind a click event which would call a validation function in your Contact object.

    This seems cleaner than creating a whole bunch of unrelated plugins to provide very specific behavior.

    EDIT TO PROVIDE EXAMPLE

    Here’s a quick & simple sample of this in action: http://jsbin.com/elefi/edit

    The code:

    if(typeof(MyDomain) == "undefined") {
      MyDomain = {};
      MyDomain.MyApp = {};
    }
    
    MyDomain.MyApp.ContactForm = function() {
      var $_submitButton;
      var $_firstNameTextBox;
    
      var _validateForm = function () {
        if($_firstNameTextBox.val() === '') {
            alert('Form Invalid');
        }
        else {
            alert('Form Valid');
        }    
      };
    
      return {
        initialize: function(submitButtonId, firstNameTextBoxId) {
          // Add context
          $_submitButton = $("#" + submitButtonId);
          $_firstNameTextBox = $("#" + firstNameTextBoxId)
    
          // Add behaviours
          $_submitButton.click(_validateForm);
        }
      }  
    }();
    
    // Emit this using your server-side code
    $(function() {
        MyDomain.MyApp.ContactForm.initialize('SubmitButton', 'FirstName');
    });
    

    Note that IE6 seems to dislike jsbin.com, so open it in FF

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

Sidebar

Ask A Question

Stats

  • Questions 357k
  • Answers 357k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You probably want to call setlocale() first, "LC_ALL" should do… May 14, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer Linux Ubuntu Desktop Jaunty Firebug FireCookie Pixel Perfect Web developer… May 14, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer Your code should look like this: var par = [];… May 14, 2026 at 9:06 am

Related Questions

I'm trying to write a re-usable .NET Assembly that implements WCF. My current problem
I'm a beginning coder, learned CSS, HTML, and Jquery in an internship this summer.
I'm working on a windowing application for a website of mine. Right now, I
I’m in the process of developing pretty basic web application, that is mostly so
On my website I have it setup where when someone clicks on one of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.