JSFiddle - React, Tailwind, and code Playground

HTML

<input  class="last"  type="text" name='text1' value="">

JavaScript

$txt=new Array();
 
 $(function(){
	 $('body').on('keydown','.last',function(){
		
		 $('.last').removeClass('last');
		 
		 $('body').append('</br></br><input class="last" type="text" name="text'+(Number($(this).attr('name').match(/[0-9]+/g))+1)+'" value="'+(Number($(this).attr('name').match(/[0-9]+/g))+1)+'">');
		 })
	 })