Custom Select Element
How do I make an custom select element?
Theres a lot of custom select solutions out there for modern browsers, but most aren't the easiest to work with, especially in FireFox where the default drop down arrow just won't disappear.. What is a custom select element? How do you make a custom select element? This script and codes were developed by Adam Grayson on 10 November 2022, Thursday.
Custom Select Element - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Custom Select Element</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="customSelect"><span></span> <select> <option>Custom Select Menu</option> <option>option 2</option> <option>option 3</option> <option>option 4</option> </select>
</div>
<div class="customSelect"><span></span> <select> <option>Cross Browser Support</option> <option>option 2</option> <option>option 3</option> <option>option 4</option> <option>option 5</option> <option>option 6</option> </select>
</div>
<div class="customSelect"><span></span> <select> <option>Any Styling</option> <option>option 2</option> </select>
</div>
<div class="customSelect"><span></span> <select> <option>Individual Instances</option> </select>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Custom Select Element - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Raleway:700);
* { box-sizing: border-box;
}
.customSelect { width: 320px; height: 60px; font: 700 14px/60px "Raleway", sans-serif; color: #042e33; background: #ffffff; border: 1px solid #d5d5d5; text-transform: uppercase; position: relative; overflow: hidden; margin: 20px auto 0;
}
.customSelect:after { top: 28px; right: 30px; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; border-color: rgba(136, 183, 213, 0); border-top-color: #88b7d5; border-width: 5px; margin-left: -5px;
}
.customSelect span, .customSelect select { width: 100%; height: 100%;
}
.customSelect span { display: block; position: absolute; top: 0; left: 0; text-indent: 30px;
}
.customSelect select { -webkit-appearance: none; -moz-appearance: none; -ms-appearance: none; -o-appearance: none; appearance: none; opacity: 0;
}
Custom Select Element - Script Codes JS Codes
(function() { $(window).load(function() { var initCustomSelects, setSelectText; initCustomSelects = function() { $('.customSelect').each(function() { var $this, value; $this = $(this); value = $this.find('select').val(); setSelectText($this, value); }); }; setSelectText = function(element, text) { element.find('span').text(text); }; $('.customSelect select').change(function() { var parent, value; parent = $(this).parent('.customSelect'); value = $(this).val(); setSelectText(parent, value); }); initCustomSelects(); });
}).call(this);
Developer | Adam Grayson |
Username | agrayson |
Uploaded | November 10, 2022 |
Rating | 3 |
Size | 3,616 Kb |
Views | 14,168 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
RPG Cooldown | 2,902 Kb |
CCS3 Navigation Hover Effect | 1,953 Kb |
Drag and Drop File Preview | 3,444 Kb |
Random Weapon Generator | 4,209 Kb |
Responsive Carousel | 3,291 Kb |
Form Progress Bar | 4,644 Kb |
HTML5 GeoLocation Example | 3,685 Kb |
Spinning Circles | 3,581 Kb |
Simple Accordion | 2,952 Kb |
Minimal Solar System | 3,425 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Sign Up Form | Sicontis | 5,272 Kb |
Flat UI Button | Honchoman | 2,289 Kb |
Dribbble Template | ExtremelyGinger | 2,204 Kb |
My Starter Kit For Codepen | Dkdesign | 2,012 Kb |
Simple, flat contact form | Zeaklous | 2,719 Kb |
Experiment | Toddmoy | 2,849 Kb |
Basic template | Tomcat | 1,675 Kb |
Fullscreen audio play button | 72 | 2,148 Kb |
A Pen by Paul Sullivan | Pwsm50 | 2,349 Kb |
CSS Variables | Jdsteinbach | 4,759 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!