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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:28:14+00:00 2026-05-23T23:28:14+00:00

I have small bug (I suppose) in my Javascript file. It is simple file

  • 0

I have small bug (I suppose) in my Javascript file. It is simple file but it is not working as expected on Firefox 6 (on Chrome it is working fine).
Everything is working except submit(), and validate() is working only when called within document.ready, if I try to access these functions directly, I get…

uncaught exception: ReferenceError: (function) is not defined

Here is the JS file http://pastebin.com/raw.php?i=CMy4WYPF, it is loaded after jQuery lib, there are no other JS files.

Thank you very much for your help.

  • 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-23T23:28:15+00:00Added an answer on May 23, 2026 at 11:28 pm

    You don’t show how or when the code is loaded, so when it is executed is unknown.

    The document markup is not provided so it is impossible to tell what may or may not work, or why. Here are some suggestions for improvements, they may or may not make any difference.

    The following statements:

    > var exception = $('#teligence-exception');
    > var form = $('#teligence-ctc form');
    

    are at the top of the script. Do the elements referenced by the IDs exist in the DOM when the statements are executed?

    Searching for codes in an array using jQuery’s inArray is inefficient in browsers that lack a native Array.prototype.indexOf method (which is quite a few). Far better to have codes as a string with a delimiter and use the ubiquitous String.prototype.indexOf() method, e.g.

    var codes = '|201|202|203|';
    ...
        var x = code.indexOf('|' + val + '|');
    

    The submit function is not called in the posted code.

    Much of the script appears very inefficient:

      > var val = $(this).val();
      > $(this).val( val.replace(/[^0-9]/, '') );
    

    can be

        var val = this.value;
        this.value = val.replace(/D/g, '');
    

    note that in the original code, only the first non-digit character will be replaced. In the suggested code, all non-digit characters will be replaced (courtesy of the g flag).

    Also:

      validate($(this).attr('name'));
    

    can be:

      validate(this.value);
    

    And so on. The idea is to not create unnecessary jQuery objects.

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

Sidebar

Related Questions

I have small utility that does some processing on a file and changes the
I have the following code with a small bug in it, the case statement
In the bug fixing of a small ASP.NET/C# web app I have made, I
I have an application that is a not so simple Windows service (C#). I
I have this small testcase: http://jsfiddle.net/sV8js/ You can see that in Chrome (tested on
I have a small bug in my client app that uses NSURLConnection. I have
I have found a weird bug in my application and due to my small
I have been working now for few days on a small C program which
have small problem, and would very much appreciate help :) I should convert byte
I have small page which has label, DropDownList and a submit button. <div> <asp:label

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.