Skip to content

Select default style changes and click events

Notifications You must be signed in to change notification settings

tiger986/select

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Select default style changes and click events

HTML code

<div>
    <select>
        <option value="1">aaaaa</option>
        <option value="2">bbbbb</option>
        <option value="3">ccccc</option>
        <option value="4">ddddd</option>
    </select>
</div>

CSS code

div{
    width: 200px;
    height: 400px;
    margin: 200px auto 0;
}
		
select::-ms-expand { display: none; } 
select{
    width: 300px;
    height: 42px;
    box-sizing: border-box;
    font-size: 14px;
    color: #666666;
    line-height: 40px;
    padding: 0px 20px 0 10px;
    border: 1px solid #E5E5E5;
    outline: none;
    appearance:none;
    -moz-appearance:none;
    -webkit-appearance:none;
    -ms-appearance:none;
    background-color: #F5F5F5;
    background-image: url(img/down.png);
    background-repeat: no-repeat;
    background-size: 12px 13px;
    background-position: 282px center;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    margin-top: 10px;
}
select option{
    background-color: #FFFFFF;
    text-align: center;
}

JS code

var text = "";
$("select").change(function(){
    text = $(this).val();
    alert(text);
});

About

Select default style changes and click events

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages