Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize the functions of hierarchical multi-selection, full-layer selection and multi-selection in html+javascript+bootstrap

Shulou Source: shulou.com Published: 2022-05-31 11:51:51 10月03日 Update

This article introduces the relevant knowledge of "how to achieve multi-level multi-selection box full-layer full-selection and multi-selection function in html+javascript+bootstrap". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The specific code is as follows:

/ / when the first layer option is selected, the second layer under this option is all selected function allSelect (check_v, checkname) {var v_item = document.getElementsByName (check_v); var items = document.getElementsByName (checkname); for (var I = 0; I < items.length; + + I) {if (v_item [0] .entries) {items [I] .items = true } else {items [I] .items = false;}} / / when all the second layer options are selected, the first layer is selected If at least one of the second layer options is not selected, then the first layer is not selected function singleSelect2parent (check_v, checkname) {var v_item = document.getElementsByName (check_v); var items = document.getElementsByName (checkname); var childStatus = true; for (var I = 0; I < items.length; + + I) {childStatus = (childStatus & & items [I] .items);} if (childStatus) {v_item [0] .items = true } else {v_item [0] .selection = false;}} / / Select all button, then all options are selected function allChecked () {var inputItems = document.getElementsByClassName ("checkbox2check"); for (var I = 0; I < inputItems.length; iTunes +) {var checkItems = document.getElementsByName ("checkbox" + (iTunes 1)); for (var j = 0; j < checkItems.length) Ul li +) {checkItems [j] .items = true;} inputItems [I] .checkItems = true;}} ul li {list-style:none } v1.0.1 v1.2.1 version 2 v2.1.1 version 3 v3.1.1 full selection "html+javascript+bootstrap how to achieve hierarchical multi-selection box full-layer full selection and multi-selection function" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Second tier version function hierarchy content more knowledge practicality achievement next code dilemma actual rare situation button article case editor website Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Redmi Shulou Information Microsoft Shulou Technology