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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:59:44+00:00 2026-06-04T02:59:44+00:00

Is it possible to use a CSS selector to target an input that has

  • 0

Is it possible to use a CSS selector to target an input that has a specific value?

Example: How can I target the input below based on the value="United States"

<input type="text" value="United States" />
  • 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-06-04T02:59:45+00:00Added an answer on June 4, 2026 at 2:59 am

    Dynamic Values (oh no! D;)

    As npup explains in his answer, a simple css rule will only target the attribute value which means that this doesn’t cover the actual value of the html node.

    JAVASCRIPT TO THE RESCUE!

    • Ugly workaround: http://jsfiddle.net/QmvHL/

    Original Answer

    Yes it’s very possible, using css attribute selectors you can reference input’s by their value in this sort of fashion:

    input[value="United States"] { color: #F90; }​
    

    • jsFiddle example

    from the reference

    • [att] Match when the element sets the "att" attribute, whatever the
      value of the attribute.

    • [att=val] Match when the element’s "att"
      attribute value is exactly "val".

    • [att~=val] Represents an element
      with the att attribute whose value is a white space-separated list of
      words, one of which is exactly "val". If "val" contains white space,
      it will never represent anything (since the words are separated by
      spaces). If "val" is the empty string, it will never represent
      anything either.

    • [att|=val] Represents an element with the att
      attribute, its value either being exactly "val" or beginning with
      "val" immediately followed by "-" (U+002D). This is primarily intended
      to allow language subcode matches (e.g., the hreflang attribute on the
      a element in HTML) as described in BCP 47 ([BCP47]) or its successor.
      For lang (or xml:lang) language subcode matching, please see the :lang
      pseudo-class.

    • css attribute selectors reference
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to use CSS sprites for foreground images -- i.e. images that
Is it possible to use 2 CSS classes that have the same name for
Well, question is in title. Is it possible at all? I can use css
Is it possible to include sibling in css selector? Case: 1) <div> <textarea/> <input/>
Is it possible to use Lift's CSS Selector Transforms together with DispatchSnippet? It does
I know it's possible to use CSS to add page breaks to web pages,
Is it possible to use Blueprint CSS and maintain a a respectable level of
I just wonder if it is possible to only use CSS but not javascript
Is it possible to use @import in one css file like this. @import file1
I know it is possible to use jQuery to do something like: $('body').css('cursor','wait'); What

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.