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 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

Related Questions

I am using Wordpress with JQuery to create a vehicle selection form. Vehicle information
I'd ideally like to create a streamlined interface which requires the user to select
I'd like to create a custom control in javascript. The goal is to create
I am using the popular jQuery Validation Plugin . It's very flexible with regards
I'm writing a helper class to wrap the functionality of JQuery Taconite plugin. The
I'm a jquery newbie... still learning the framework.... and here goes my query... The
Rehashing an older post: JQuery VS Flex - Choosing a Platform for SAAS We
I have to create a small who does what web application for incoming letter
I'm a beginning coder, learned CSS, HTML, and Jquery in an internship this summer.

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.