How to use Checkbox inside Select Option HTML JavaScript CSS Tutorial

preview_player
Показать описание
Hi guys, welcome back to Angga Risky, In this video, I want to show you about how to create the checkboxes inside of select option using HTML, CSS, and JavaScript.

So, check this out guys:

Follow Me ==========================================

facebook : @anggariskys
twitter: @anggariskys
instagram: anggariskysetiawan
Рекомендации по теме
Комментарии
Автор

Very older your vidio but very useful, I have been looking for a multiselect component for bootstrap 5 but I did not find it, but you teached me that I can build my own customized component, Thanx

madison_master
Автор

thank you very much, finally something native, most use bootstrap and that breaks css styles. Thanks again

rosasmartin
Автор

Best video, it was very useful for me ☺️☺️☺️👏👏

shirishanampally
Автор

your example to save my time and life, thank you

fernandochicatafarfan
Автор

Source Code: Copied


<html>
<head>
<style>
.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;
}
</style>
</head>
<body>
<form>
<div class="multiselect">
<div class="selectBox" onclick="showCheckboxes()">
<select>
<option>Select and Option</option>
</select>
<div class="overSelect"></div>
</div>
<div id="checkboxes">
<label><input type="checkbox" id="1"/>One</label>
<label><input type="checkbox" id="2"/>Two</label>
<label><input type="checkbox" id="3"/>Three</label>
</div>
</div>
</form>
</body>

<script>
var expanded = false;
function showCheckboxes()
{
var checkboxes =
if(!expanded)
{
checkboxes.style.display = "block";
expanded = true;
}
else
{
checkboxes.style.display = "none";
expanded = false;
}
}

</script>
</html>

relyontestmail
Автор

P.s question: how to make JS be on top (drop down options) and do not move html elements and others div? because your example working but it moves others objects which is bellow this contraction. is there any solution?

rimantasdanilevicius
Автор

Thanl you so much you really help me a lot

nemuelcastillo
Автор

Should be a crime to show something as good as this and not include the source code to

NorthDtagg
Автор

how to change position of select box which CSS proo should i change?

nikhilkunkulol
Автор

The dropdown works but if i add navbar and footer the whole webpage positioning shifted.

moldyloaf
Автор

Anyone have any idea as to how I can make the drop down overlap over content? I've implemented this drop down into a table but when I expand the menu, it expands the table width also. A regular a select menu overlaps over other table rows and does not expand the grandparent table row.

thecodetoad
Автор

Very useful tutorial. Thanks! If would be included source code it would be amazingly useful :)

rimantasdanilevicius
Автор

seriously you are copy/pasting from somewhere else and not providing source :(

MirzaNawazish