technomark.in
Hot News

$(this) Selector And Children / Find In jQuery

Detect An Undefined Object Property In JavaScript

Rotate And Save Video Using VLC Media Player

Capitalize The First Letter Of String In JavaScript

Convert Any Files To Any Format Using VLC Media Player

Asp.Net AngularJS WCF IIS
DataBase Jquery Bikes Random
HomeContact Us Watch Our YouTube Channel ..........Blog Spot..........

Technomark.in

How To Logout From All Devices In Skype

Technomark.in

How To Embed Google Map In Your Code

Technomark.in

How To Install IIS (Internet Information Services) On Windows

Technomark.in

Enable Directory Browsing In IIS

View All


Make Placeholder For A Select Box


Make Placeholder For A Select Box

> Here we consider how to Make Placeholder For A Select Box.
> We have to use CSS and Jquery for making placeholder for Select Box.

Make Placeholder For A Select Box, Make Placeholder For A Combo Box, Placeholder For A Select Box, Placeholder For A Combo Box, Placeholder For A Combo Box Juqery, Placeholder For A Combo Box CSS, Placeholder For A Combo Box Jquery And CSS, Jquery, CSS

Make Placeholder For A Select Box - Step 1

> In Css region, you can write following style.

#SelectID option
{
        color: black;
}
.placeHolder
{
        color: gray;
}



> Here SelectID is the ID of Select Box.
> placeHolder is the class that will be applied for Select Box.

Make Placeholder For A Select Box - Step 2

> On Script part, we have to add following code.

$(function () {
         $("#SelectID").change(function () {
                if ($(this).val() == "0") {
                $(this).addClass("placeHolder");
                }
                 else {
                 $(this).removeClass("placeHolder")
                }
        });
         $("#SelectID").change();
})



> On page load we would add the class placeHolder to the first item.
> Here we listen the change event for Select Box.
> If the SelectedIndex is Zero, then we append class placeHolder to the Selected Item.
> Else the Class placeHolder will be removed.
> Now run your application, you will see a placeholder on Select Box.

Watch Video of this Content on Video Steaming

Post Your Comment

Name *


Email *


Comment * Please provide all three fields for posting Comment




Technomark.in

Book Train Tickets on IRCTC Quickly During Tatkal Period

Technomark.in

Before You Copy Any Image From Internet

View All

Privacy StatementDisclaimerSitemap