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

The Archive Base Latest Questions

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

Does it matter which way the following selector is written? It validates both ways

  • 0

Does it matter which way the following selector is written? It validates both ways and the W3C spec seems silent on the issue of quotation marks.

Option 1:

input[type=text]

Option 2:

input[type='text']

I’ve seen selectors that work both with and without quotes. Do both ways always work for either CSS or jQuery?

So, is using the quotation marks simply a matter of preference? Semantics? CSS version?

Do we have two methods because of backward compatibility? If so, which way is best going forward?

Despite the accepted answer to this other SO question, I’m thinking quotes is best:

input[type='text']
  • 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-28T16:45:24+00:00Added an answer on May 28, 2026 at 4:45 pm

    I’d sum it up this way:

    • For some sequences of characters (legal identifiers), you don’t need quotes.
    • For all other sequences of characters (like anything that starts with a number), you must use quotes.
    • If you KNOW what constitutes a legal CSS identifier and that’s what you have, you can leave off the quotes.
    • If you KNOW that what you have is not an identifier, you must put in the quotes.
    • If you don’t want to think about it and want to do it consistently all the time, use the quotes.

    For [type=text], you can leave off the quotes if you want to because text is a legal CSS identifier.

    I personally prefer consistency and not having to think about it and less of a chance of making a mistake so I always put in the quotes.

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

Sidebar

Related Questions

Which of the following is the best way to implement a poco? Option 1:
Does it matter to developers that the current, and newer versions of .Net don't
does it matter at all what order the <link> or <script> or <meta> tags
Does it matter how many files I keep in a single directory? If so,
Does endianness matter at all with the bitwise operations? Either logical or shifting? I'm
It does not matter what programming language. Can anyone please give me an idea
I have a Python program (with Django - does this matter?) that I want
I'm on OS X 10.5.5 (though it does not matter much I guess) I
Exactly that: Does a strings length equal the byte size? Does it matter on
For doing development, does it matter what OS PHP is running on? In other

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.