Search
 
SCRIPT & CODE EXAMPLE
 

HTML

Select with checl box

<form>
  <div class="multiselect">
    <div class="selectBox" onclick="showCheckboxes()">
      <select>
        <option>Select an option</option>
      </select>
      <div class="overSelect"></div>
    </div>
    <div id="checkboxes">
      <label for="one">
        <input type="checkbox" id="one" />First checkbox</label>
      <label for="two">
        <input type="checkbox" id="two" />Second checkbox</label>
      <label for="three">
        <input type="checkbox" id="three" />Third checkbox</label>
    </div>
  </div>
</form>


------------------------------------------------------
.multiselect {
  width: 200px;
}

.selectBox {
  position: relative;
}

.selectBox select {
  width: 100%;
  font-weight: bold;
}

.overSelect {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

#checkboxes {
  display: none;
  border: 1px #dadada solid;
}

#checkboxes label {
  display: block;
}

#checkboxes label:hover {
  background-color: #1e90ff;
}

-----------------------------------------------------------

var expanded = false;

function showCheckboxes() {
  var checkboxes = document.getElementById("checkboxes");
  if (!expanded) {
    checkboxes.style.display = "block";
    expanded = true;
  } else {
    checkboxes.style.display = "none";
    expanded = false;
  }
}
Comment

PREVIOUS NEXT
Code Example
Html :: excel auto tage with date and time 
Html :: html container farbverlauf 
Html :: handlebar js basic example 
Html :: html month set default 
Html :: favicon icon 404 error for html 5 
Html :: Hide overflow for Absolute images 
Html :: bootstrap input tagsinput 
Html :: boton en html cambiar texto 
Html :: html relative path go back one directory 
Html :: html go up a folder 
Html :: html pdf template 
Html :: chessbase html 
Html :: how link back to home page html without index 
Html :: navbar tailwind 
Html :: tags semanticas 
Html :: bootstrap v5 tooltip 
Html :: best background color in html 
Html :: input groups 
Html :: html height percentage not working 
Html :: how to mask input in html as phone numbr 
Html :: how to change the font in html 
Html :: html text next line 
Html :: htaml p 
Html :: how to add particle js in html 
Html :: shchema keyref et key use 
Html :: conditions option in html 
Html :: acept img html 
Html :: html like symbol 
Html :: how to make a scroll horizontally button in html 
Html :: see emoji flag on desktop 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =