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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:53:37+00:00 2026-05-23T02:53:37+00:00

This is probably something simple I’m overlooking but my google-fu isn’t turning anything up

  • 0

This is probably something simple I’m overlooking but my google-fu isn’t turning anything up that could explain the cause. Take the following snippet for example (Ignoring for now that embedded js is generally considered bad practice):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html> 
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>
    </title>
</head>
<body> 
    <form action="">
      <div>
        <input type="text" id="pattern" value="foobar">
        <input type="button" value="Alert" OnClick="alert(pattern.value);">
      </div>  
    </form>
</body> 
</html>

The above will print the alert message ‘foobar’ in IE8 and Firefox 3 but Chrome will print ‘undefined’. Changing pattern to something else like pattern_ will print ‘foobar’ for all three browsers as expected.

Is pattern a reserved word or a name used for one of the builtin js libraries? What’s the reason for this not working under Chrome?

  • 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-23T02:53:38+00:00Added an answer on May 23, 2026 at 2:53 am

    Because internally the mentioned browsers attach DOM elements as Objects to the global namespace (window). So, an object with id="xyz" can also be addressed as window.xyz or even as xyz. I suppose Chrome doesn’t do this.

    Also check my SO-question about this, especially the selected answer.

    [edit] after comment: it’s Chrome (webkit) related indeed and it may have something to do with what I found here. See also quirksmode (search the page for ‘pattern’ it looks like in HTML5 pattern is an attribute of input, so I can imagine that interferes with an id having the same name)

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

Sidebar

Related Questions

This is probably something simple but I'm scratching my head over easing with the
This is probably something extremely simple but I can't get my head around it
I get the feeling this is probably something I should know but I can't
This probably has a simple answer, but I must not have had enough coffee
Ok, this probably has a really simple answer, but I've never tried to do
This is probably a really simple jQuery question, but I couldn't answer it after
This is probably something very simple, so forgive my blonde moment :) I have
It's probably the tenth time I'm implementing something like this, and I've never been
This probably sounds really stupid but I have noo idea how to implement jquery's
Okay, so this probably sounds terribly nefarious, but I need such capabilities for my

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.