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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:51:23+00:00 2026-05-24T22:51:23+00:00

The problem that I’m having is that my code works fine in JavaScript but

  • 0

The problem that I’m having is that my code works fine in JavaScript but doesn’t work correctly in Firefox or safari and wondering why. What I’m doing is I have a loop going through each element and depending on the variable inside a text box just want to alert something. Like i said earlier this code works fine in IE. Here is the code below:

Here is an example of text box:

<asp:TextBox ID="txtMac" runat="server" req="yes" errMessage="Mac"/>

for (a = 0; a < theForm.elements.length; a++) {
  if (theForm.elements[a].type == "text" && theForm.elements[a].req == "yes") {
    alert("Made it here")
  }
}
  • 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-24T22:51:24+00:00Added an answer on May 24, 2026 at 10:51 pm

    Use getAttribute to read the custom attributes. See http://jsfiddle.net/8EWQr/.

    So instead of

    (theForm.elements[a].type == “text” && theForm.elements[a].req == “yes”)

    use

    (theForm.elements[a].getAttribute(‘type’) == “text” && theForm.elements[a].getAttribute(‘req’) == “yes”)

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

Sidebar

Related Questions

The problem that I am having has to do with the need to keep
I am having the problem that I cannot select a specific XML node which
I have a wierd problem that i need to work out how to resolve,
I have a problem that I had working in a test but now in
XML problem that's got me stumped, but is probably very simple... The XML is
The problem that i'm having is how can i synchronise my datasets in my
The problem that i am having is I am using a touch listener for
The problem that I am having is a little hard to describe, so please
The problem that I am having is that my values aren't coming through with
The problem that I am having is that I am trying to embed an

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.