dreamer17,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<select id="select">
<option value="">change</option>
<option value="1">one</option>
<option value="2">two</option>
</select>
<div id="div" hidden>
</div>
<script>
$(function() {
var div = $('#div');
$('#select').change(function() {
var slc = this.value;
div.empty();
div[0].hidden = !slc;
if (!slc) return;
var limit = slc == '1' ? 4 : 2;
for (let i = 0; i < limit;) {
var inp = $('<input>', {
id: 'inp' + ++i
});
div.append(inp);
}
});
});
</script>
</body>
</html>