I'm trying to add the margin of the select div when the value selected I'm not an expert in the javascript I found javascript on another blog but I think that does not work Help me to do that
Here is my code
<style>
.container{
border:2px solid black;
margin-top: 20px;}
</style>
<div class="html-code-output">
<div class="main">
<p>Select an option to show the value and text of that option.</p>
<select class="addon-select">
<option value="">Select a Option</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
<div class="container">
<h4>Add a margin when we select the an option</h4>
</div>
</div>
</div>
<script>
jQuery('.addon-select').on('change', function () {
let val = $(this).val();
$(".main").css("margin-bottom", "1rem");
$(".main('" + val + "') ").css("margin-bottom", "5rem");
});;
</script>