html - 下拉文本框的按钮

标签 html css button click dropdown

我正在尝试使用 CSS/HTML 编写一个按钮,当您单击它时,它会下拉/显示一个文本框。

这是我要实现的目标的图像:

what I'm trying to achieve

最佳答案

试试这个:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">    </script>
<script> 
$(document).ready(function(){
$("#flip").click(function(){
    $("#panel").slideToggle("slow");
});
});
</script>

<style> 
#panel, #flip {
padding: 5px;
text-align: center;
background-color: #e5eecc;
border: solid 1px #c3c3c3;
}

#panel {
padding: 50px;
display: none;
}
</style>
</head>
<body>

<div id="flip">Click to slide down panel</div>
<div id="panel">Hello world!</div>

</body>
</html>

关于html - 下拉文本框的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34033334/

相关文章:

html - 跨 DIV 拆分的表单 - CSS 不起作用

javascript - JQuery 选择器不适用于 id

javascript - 使用 jquery 追加 PHP echo

c# - 设置 Material 设计 :PackIcon code behind

html - 带渐变外边框的按钮

jquery - 当我克隆一个部分时,HTML 格式被破坏

javascript - 使用jquery在按钮单击事件上增加整个网页的字体大小

html - 向 HTML/CSS 中的部分添加背景颜色时出错

javascript - 导航栏 jQuery 不工作

java - 如何从请求对象中选择 JSP 中的所需按钮