Answers for "Dynamic Array Values Convert into Array of Object in JavaScript"

0

Dynamic Array Values Convert into Array of Object in JavaScript

<input type="text" name="header_key[]" class="form-control m-input" placeholder="Key" autocomplete="off">
    <input type="text" name="header_val[]" class="form-control m-input" placeholder="Value" autocomplete="off"> 
						
					var obj_headers={}
						var header_key = $("input[name='header_key[]']").map(function(){
							return $(this).val();
						}).get();
						
						var header_val = $("input[name='header_val[]']").map(function(){
							return $(this).val();
						}).get();
						
						for (var i = 0; i < header_key.length; i++) {
							debugger;
							obj_headers[header_key[i]] = header_val[i];
						}
Posted by: Guest on August-09-2021

Code answers related to "Dynamic Array Values Convert into Array of Object in JavaScript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language