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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:20:32+00:00 2026-05-30T15:20:32+00:00

In jQuery, why does this: $(‘<div open=whatever>’).attr(‘open’) Always evaluate to ‘open’ instead of ‘whatever’

  • 0

In jQuery, why does this:

$('<div open="whatever">').attr('open')

Always evaluate to 'open' instead of 'whatever'? In contrast, this:

$('<div asdf="whatever">').attr('asdf')

Evaluates to 'whatever' as expected.

Yes, I am aware that open and asdf are not valid HTML attributes; I’m not looking for answers that say something along the lines of “just use data-open“, etc… I am looking for an explanation of the above behavior.

  • 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-30T15:20:33+00:00Added an answer on May 30, 2026 at 3:20 pm

    open is actually a valid attribute for HTML5 that’s meant to be a boolean. If that’s the case, I suspect that if you have “open” set at all, the browser is evaluating it as true and returning that it is “open”.

    I’d be more curious to know why it’s returning “open” instead of “true”. Probably due to incomplete implementation in various browsers. In one way or another they may have set that attribute aside for later.

    [addendum: as per comments, this seems to be the way HTML treats booleans]

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

Sidebar

Related Questions

Given this HTML: <div class=OpenIDSelector>some text</div> Why does this JQuery selector match it on
Does anyone have any idea what this jQuery selector will do? object.find('td:eq(1) div div');
what does this code performs? if(object.jquery){ .... } I don't know what jQuery attribute
Why does this empty the text immediately (ignoring delay)? $('#error_box_text').html('error text').delay(5000).html('') # jQuery 1.4
Why this delay of Jquery animation does not work as it should be? $(
How do I unbind hover in jQuery? This does not work: $(this).unbind('hover');
I found this jquery plugin which does exactly what I need, but I want
On my main page I have this jquery code which does an ajax call
I am newbie to jQuery, can someone explain what this code does: $(#currency form).submit(function(e)
Here's the story... I have a jQuery function that does something, this function is

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.