<html>

<head>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
	<script>
		$(document).ready(function() {
			$("#btn").click(function() {
				var first_number = 0;
				var second_number = 1;

				var size = $("#number").val();
				result = $("#result");
				var output = '0,1';

				for (i = 0; i < size - 2; i++) {
					var next_number = first_number + second_number;
					output = (output + (",") + next_number);
					first_number = second_number;
					second_number = next_number;
				}
				$("#result").html(output);
			});
		});
	</script>
</head>

<body>
	Enter the number of items in fibonacci series:
	<input type="text" name="value" id="number"></input>
	<button id="btn"> Submit </button><br>
	<h4>Output: <br> <span id="result"></span></h4>
</body>

</html>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.