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

The Archive Base Latest Questions

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

I was reading something about boolean attribute here , which says that for a

  • 0

I was reading something about boolean attribute here, which says that for a boolean attribute (in this particular example, loop attribute of <audio>), whatever value you set, it is going to be recognized as “true”. In order to really set to falsy, you cannot set it like loop=false or with javascript as ['loop']=false, but have to remove the attribute such as by doing removeAttribute('loop'). Is this true?

I first believed it, but as far as checked it with Chrome, it seems that setting to ['loop']=false will actually do make it be recognized as falsy. I am not sure how robust this fact is when considered cross-browserly. Is there any difference among browsers?

  • 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-28T04:23:52+00:00Added an answer on May 28, 2026 at 4:23 am

    Boolean attributes are explained here:

    http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.3.4.2

    Some attributes play the role of boolean variables (e.g., the selected
    attribute for the OPTION element). Their appearance in the start tag
    of an element implies that the value of the attribute is “true”. Their
    absence implies a value of “false”.

    Boolean attributes may legally take a single value: the name of the
    attribute itself (e.g., selected=”selected”).

    So, while some browsers may interpret the string “false” as if the value was not set, others may not decide to (which is the correct behavior). Actually, as far as I know (or thought), any non-empty string usually sets the value to on/true (regardless of what the spec says is a legal value). I believe this is also undefined behavior, so this may change as well or be different from browser to browser (don’t rely on it).

    The bottom line is, just because a browser or two may deviate from the spec doesn’t mean that you should. Removing the attribute entirely is the way to go.

    Addendum: Looking at your comments and question a little closer, I think you may be confused about attribute values in general. In HTML, attr=false and attr="false" are exactly the same. Quotes are not required in any version of HTML (unless they are needed to remove ambiguity when the value contains spaces). For instance:

    <input class=required>
    <!-- This is fine -->
    
    <input class=title required>
    <!-- this is fine too, but "required" will be parsed as an attribute -->
    
    <input class="title required">
    <!-- To have two classes, we need the quotes -->
    

    All attribute values (on elements that have them) are treated as strings. In other words, there is no such thing as a true boolean value (or NULL value) in HTML like there is in javascript.

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

Sidebar

Related Questions

Reading about Kohana templates and saw something I've never seen before: $this->template->title = __('Welcome
I've been reading that if I have something like this: @property (nonatomic, assign) UIView
I'm reading something about overload resolution and I found something that bothers me...In the
I was reading this article: http://sqlserverpedia.com/wiki/Understanding_the_StackOverflow_Database_Schema and the writer wrote something special about the
I seem to remember reading something about how it is bad for structs to
When I first started reading about and learning ruby, I read something about the
I've been reading that M3G is something based on OpenGL ES...so can I work
Hello I'm trying something .. I was reading Jquery traversing documentations some forums, this
After reading this question , I've learned that denormalization is not a solution for
I am about to upload my app today and remember reading something about giving

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.