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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:05:51+00:00 2026-06-13T23:05:51+00:00

I have a select drop down with the default title Country as grey. However

  • 0

I have a select drop down with the default title Country as grey.
However the grey only shows up when you click into the field.
How can i have the visible field with the default as grey so that it matches other fields?
enter image description here

.form_0{color:#777;}

<select value='country' id='country' name='Country'>
    <option class='country' disabled='disabled' selected='selected' class='form_0'>Country</option>
    <option class='country'>Brazil</option>
    <option class='country'>China</option>
    <option class='country'>India</option>
    <option class='country'>Spain</option>
    <option class='country'>USA</option>
    <option class='country'>Japan</option>
    <option class='country'>Russia</option>
</select>

enter image description here

  • 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-13T23:05:52+00:00Added an answer on June 13, 2026 at 11:05 pm

    Something like this maybe :

    $("#country").on('change', function() {
        $(this).toggleClass("empty", this.value == "0");
    }).change();​
    

    You’ll need to add values to your select, and change it a little bit:

    <select id='country' name='Country'>
        <option value="0" class='country' selected='selected'>Country</option>
        <option value="1" class='country'>Brazil</option>
        <option value="2" class='country'>China</option>
        <option value="3" class='country'>India</option>
        <option value="4" class='country'>Spain</option>
        <option value="5" class='country'>USA</option>
        <option value="6" class='country'>Japan</option>
        <option value="7" class='country'>Russia</option>
    </select>​
    

    As a sidenote, you can’t define class twice, you define two classes but doing:

    <option class='country form_0'></option>
    

    in the same decleration seperated by a space, two class declerations won’t work.

    DEMONSTRATION

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

Sidebar

Related Questions

i have a form that has a multiple select drop down. a user can
I have capture change event on drop down select. This drop down field is
I have a drop down list where users can select a theme for the
I have this drop-down list of countries: <select name=country> <option value=>Country...</option> <option value=Afganistan>Afghanistan</option> <option
I have a 'select' drop-down with a list of players' names, which by default
On my page I have a drop-down select box, with a default value of
Ok here goes: I have a SELECT drop down option with US state names
We have all seen countless instances of forms with a select drop down having
I have a form with two text boxes, one select drop down and one
I have implenmented drop-down lists Select menus in jQuery Mobile. <div data-role=fieldcontain> <label for=name

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.