JSFiddle - React, Tailwind, and code Playground

by Joe Saad

HTML

<input type="text" name="page_1">
<input type="text" name="page_2">
<input type="text" name="page_3">
<input type="text" name="page_4">
<button type="button">Pages</button>

JavaScript

var myObj = {};

$('button').click(function(){
	$('input').each(function(e){
  	myObj[$(this).attr('name')]=$(this).val();
  })
  console.dir(myObj);
})