gpt4 book ai didi

html - 制作一个可编辑的下拉框

转载 作者:行者123 更新时间:2023-11-28 12:20:21 25 4
gpt4 key购买 nike

如何将现有的自定义下拉框转换为可编辑的下拉框。是否可以在下拉框所在的位置放置一个输入框?是否可以在不加载任何繁重的框架的情况下完成此操作?

这是当前的 HTML 标记:

<html>

<style>
#select_box {
position: absolute;
width: 179px;
clip:rect(2px 197px 19px 2px);
top: -1px;
font-size: 9pt;
font-family: Arial;
}
#select_wrapper {
display: block;
position: relative;
width: 181px;
border: 1px solid rgb(128,128,128);
height: 21px;
background: #ffffff;
}
</style>


<body>
<div id="select_wrapper">
<select id="select_box">
<option value=""></option>
<option value="ONE">ONE</option>
<option value="TWO">TWO</option>
<option value="THREE">THREE</option>
<option value="FOUR">FOUR</option>
<option value="FIVE">FIVE</option>
<option value="SIX">SIX</option>
</select>
</div>
</body>
</html>

最佳答案

无CSS3规范不支持详细编辑标签选择您可以使用 jQuery Selectbox 插件 http://www.bulgaria-web-developers.com/projects/javascript/selectbox/很久以前我遇到了同样的问题),找到了解决方案) http://codepen.io/AntonEssenetial/pen/gGqel

CSS:

.pseselect {
position: relative; // YOUR CONTAINER STYLE
padding:;
height:;
border:;
border-radius: ;
background:;
box-shadow:;
font-size:;
line-height:;
cursor:;
transition: .2s ease-in-out;
}

.pseselect::after {
position: absolute;
top:
right:
display: block;
width:
height:
background: url( YOUR IMG ) center no-repeat;
content: "";
}

.options {
position: absolute; YOUR SLECT STYLE
z-index: ;
display: none;
border: ;
border-radius: ;
background: white;
font-size: 13px;
}

.options > div {
padding:;
font-weight: normal;
cursor: pointer;
}

.options > div:hover {
background: #eee;
}

HTML:

<div class="pseudo-select input-a">
<div class="pseselect">Select</div>
<div class="options">
<div class="check" >Select</div>
<div>Select</div>
<div>Select</div>
<div>Select</div>
</div>
</div>

JavaScript:

(function($) {
$(document).ready(
function() {
$('.pseselect').click(function() {
$(this).parent().find('.options').fadeIn('fast');
});
$('.options').mouseleave(function() {
$(this).fadeOut('fast');
});
$('.options > div').click(function() {
$(this).closest('.pseudo-select').find('.pseselect').html($(this).html());
$(this).closest('.pseudo-select').find('input').attr('value', $(this).attr('value'));
$.each($(this).parent().children('div.check'), function() {
$(this).removeClass('check');
});
$(this).addClass('check');
$(this).parent().fadeOut('fast');
});
}
);
})(jQuery);

关于html - 制作一个可编辑的下拉框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18900112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com