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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:24:38+00:00 2026-05-24T12:24:38+00:00

I am learning jquery and started my first attempt at building a form validation

  • 0

I am learning jquery and started my first attempt at building a form validation script based on what I know so far (which isnt much).

This is really only the Radio button portion of the validation script, but I thought I get on the right track -coding wise- before I went too far. There are some fundamental issues that I know need addressing.

The Script (jsFiddle): http://jsfiddle.net/pkdsleeper/xNt5n/

The Questions:

a. How best to remove the global variables using 
b. jsLint recommends "use strict", so I added it, but im not sure what it does. 
c. any good refs?
d. Generally, feel free to rip this code apart (cuz I AM trying to learn) but 
   please explain my errors in noob-speak :)

Thanks In advance
sleeper

  • 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-24T12:24:38+00:00Added an answer on May 24, 2026 at 12:24 pm

    a. How best to remove the global variables using

    Wrap it in an anonymous function and assign it to the form as a submit listener.

    b. jsLint recommends “use strict”, so I added it, but im not sure what it does. any good ref’s?

    Don’t bother. It’s just a buzz-word for those trying to be hip. You can’t use strict mode features on the general web because way too many browsers don’t support them. You can use it with otherwise compliant ES 3 code, but it’s only useful as a debugging tool for errors that should have been found during testing anyway (e.g. calling constructors without new).

    No c?

    d. Generally, feel free to rip this code apart (cuz I AM trying to learn) but please explain my errors in noob-speak 🙂

    >   $rdoGroup = [], // an empty array which will be used to hold 
    

    You seem to be using $ to indicate a variable that references a jQuery object, but $rdoGroup is just an array. That may be confusing later.

    >     $rdoGroup.push($(this).attr("name"));
    

    The $ function is very expensive, don’t use it if you don’t need to. Standard HTML attributes are available in all browsers as DOM properties, so:

          $rdoGroup.push(this.name);
    

    Is up to 100 times more efficient, depending on the browser.

    >     for (i = 0; i < $rdoGroup.length; i++) {               
    >         if ($rdoGroup[c].toString() !== $(this).attr("name").toString()) {
    

    The values assigned to $rdoGroup are strings, calling their toString method is redundant.

    As above, use this.name. The name property is a string, so no need for toString.

    I think the exercise would be easier without jQuery, which seems to be getting in the way far more than helping. If you are trying to learn javascript, I’d suggest that you learn javascript without using any library.

    Once you are reasonably confident with using javascript, then you are far better equipped to use a library for the things the library is good with, and not using it for the things it isn’t good at.

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

Sidebar

Related Questions

I've just started learning Jquery but the examples aren't helping me much... Now whats
I started learning jQuery just yesterday, and I like it very much. And now
I started learning programming 4 months ago. So far I already know some javascript(and
I'm learning jQuery and this is my code so far: <script type=text/javascript> $(document).ready(function(){ $('#login').click(function(){
First I should say I only started learning HTML,PHP,Jquery a couple of weeks ago
I have just started learning Jquery and am new to writing javascript (I am
Where is a good place to get started learning how to use jQuery? It
I've just started learning jQuery/javascript, so this might seem like a really basic question,
I have started learning MVC2. I developed a simple customer search screen with Jquery
Hey, I've just started learning JavaScript and I'm making a little script that generates

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.