简体   繁体   English

我如何使用 html css js 制作带有搜索栏的自定义 select 框

[英]How I can make custom select box with search bar using html css js

i am trying to make a custom select box with search bar using html css and js.我正在尝试使用 html css 和 js 制作带有搜索栏的自定义 select 框。 once done it didn't work (scroll bar didn't work, and search bar too)完成后它不起作用(滚动条不起作用,搜索栏也不起作用)

To display some text when the checkbox is checked:选中复选框时显示一些文本:

HTML: HTML:

Checkbox: <input type="checkbox" id="myCheck" onclick="myFunction()">
<p id="text" style="display:none">Checkbox is CHECKED!</p>

JavaScript: JavaScript:

function myFunction() {
    // Get the checkbox
    var checkBox = document.getElementById("myCheck");
    // Get the output text
    var text = document.getElementById("text");
    // If the checkbox is checked, display the output text
    if (checkBox.checked == true){
        text.style.display = "block";
    } else {
        text.style.display = "none";
}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在悬停时制作HTML框,并使用JS或CSS显示其下方的文本 - How can I make an HTML box slide on hover and reveal the text underneath it using JS or CSS 如何使用 React JS 在选择框中进行搜索? - How to make search in select box using React JS? 如何使输入框中的第三个项目具有不同的颜色? (JS、HTML、CSS) - How can I make the third item entered into an input box a different color? (JS, HTML, CSS) 如何使用CSS和JavaScript / jQuery在HTML中创建自定义选择框? - How to make custom Select Boxes in HTML using CSS and JavaScript/jQuery? 我如何使用JavaScript和CSS使栏出现和消失 - How can i make a bar appear and dissapear using javascript and css 我怎样才能让它显示这个元素的底部? (HTML, CSS, JS) - How can i make it show the bottom of this element? (HTML, CSS, JS) 如何制作一个下拉框(选择元素)以接受html中的文本搜索? - How to make a dropdown box(select element) to accept text search in html? 如何创建默认状态/清除容器并使用 HTML/CSS/JS 替换为新项目 - How can I make a default state/Clear the container and replace with new items using HTML/CSS/JS 如何使文章的搜索栏工作 HTML/CSS - How to make the search bar for articles work HTML/CSS 我可以制作一个我可以在CSS,JS和HTML之间共享的自定义颜色定义吗? - Can I make a custom colour definitions that I can share between CSS, JS and HTML?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM