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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:20:22+00:00 2026-05-27T20:20:22+00:00

Do most modern browsers support ids in script tags such as: <script id=aParticularScript>/* …

  • 0

Do most modern browsers support ids in script tags such as:

<script id="aParticularScript">/* ... */</script>

The reason I ask is that Eclipse displays a warning stating “undefined attribute name” but it works fine in Google Chrome when I use jQuery selectors to get other properties of the script element. W3Schools states that the script element does not support any standard attributes (including the id attribute), but I’ve learned not to trust W3Schools.

Is it okay to have the script tag have an id?

  • 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-27T20:20:23+00:00Added an answer on May 27, 2026 at 8:20 pm

    HTML 4 Answer:

    No, you can’t, at least not if you want valid HTML…

    The following elements can’t have an ID attribute:

    • <base>
    • <head>
    • <html>
    • <meta>
    • <script>
    • <style>
    • <title>

    There might be a couple more.

    This is confusing because viewing just the documentation for the ID/class attributes doesn’t specifically say that they can’t be used with these elements. You have to look at the DTD for the elements to see that the general attributes are not defined for the element, and thus cannot be used.


    HTML 5 Answer:

    The default document type declaration, HTMLElement, which applies to all elements in HTML specifies that these global attributes (including the ID attribute) can be used on any element you create, so it would appear you can do this in HTML 5, but not in HTML 4.

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

Sidebar

Related Questions

Now that most modern browsers support AJAX and client-side requests without performing a POST,
Okay, so we all know that most modern browsers (without tweaking) are set to
I'm developing a webapp for a client that requires compatibility across most modern browsers
According to http://caniuse.com/script-defer , most browsers support the script tag's defer attribute. I would
Saving and auto-filing of username/password is a feature of most modern browsers. And the
In most modern IDEs there is a parameter that you can set to ensure
It appears that most modern languages and tools allow for extended regular expressions, and
In most modern systems, the system will automatically create extra files that are unnecessary.
Most smartphones use modern browser engines that have implementing HTML 5 (or at least
Since many modern browsers support CSS3, I would like to use many CSS 3

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.