简体   繁体   中英

How to change border color of jquery Select2?

How can I change the border color of this. I generally got it from this answer

 $(document).ready(function() { $("select").select2(); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <link href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.min.js"></script> <select id="select_page" style="width:200px;" class="operator" style="border: 2px solid red;"> <option value="">Select a Page...</option> <option value="alpha">alpha</option> <option value="beta">beta</option> <option value="theta">theta</option> <option value="omega">omega</option> </select>

You can style elements with CSS, so if you want every select2-selection class to have a certain border-color , you can add the following:

.select2-selection {
  border-color: green; /* example */
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM