javascript - Hiding then showing the dropdown arrow in jquery from a select element -
i can hide dropdown arrow in select element css! want hide , more importantly show in jquery?
select { -webkit-appearance: none; -moz-appearance: none; text-indent: 1px; text-overflow: ''; }
<select style="border: 0px;"> <option value="0">test1</option> <option value="1">test2</option> </select>
you create custom css class hides drop down arrow , use jquery toggle class on select element.
for needs may need use jquery methods addclass , removeclass instead of toggleclass.
$('#toggle').on('click', function() { $('#select').toggleclass('hide'); });
.hide { -webkit-appearance: none; -moz-appearance: none; text-indent: 1px; text-overflow: ''; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button id="toggle">toggle</button> <select id="select" style="border: 0px;" disabled> <option value="0">test1</option> <option value="1">test2</option> </select>
Comments
Post a Comment