xxxxxxxxxx
1
<div class="form-outline">
2
<input type="text" id="form12" class="form-control" />
3
<label class="form-label" for="form12">Example label</label>
4
</div>
xxxxxxxxxx
1
input {
2
min-width: 150px;
3
}
4
5
.form-outline {
6
width: fit-content !important;
7
}
xxxxxxxxxx
1
const input = document.querySelector('input');
2
input.addEventListener('input', resizeInput);
3
4
function resizeInput() {
5
input.style.width = input.value.length + "ch";
6
}
Console errors: 0