Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js get target foreach

handleSubmit(event) {
    event.preventDefault();

    let target   = event.target;
    let formData = {};

    for (let i = 0; i < target.length; i++) {
        formData[target.elements[i].getAttribute("name")] = target.elements[i].value;
    }
    console.log('formData', formData); 
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: node js mysql variables 
Javascript :: how to format a javascript date 
Javascript :: .change() in pure js 
Javascript :: node js middleware for parsing formdata 
Javascript :: discord.js find word inside comment 
Javascript :: send object from laravel to react js component 
Javascript :: inject html via template tags js 
Javascript :: str_limit function filter vuejs 
Javascript :: snackbar in react 
Javascript :: why does javascript let you write a function without the parentheses 
Javascript :: node.js express export routes 
Javascript :: The data option must be a function. Plain object usage is no longer supported. vue 
Javascript :: hardhat async test 
Javascript :: arduino vscode hex 
Javascript :: inline if statement javascript 
Javascript :: react disabled attribute 
Javascript :: regex city and state 
Javascript :: deploy react to azure : web.config 
Javascript :: how contvert array to string like implode in jquery 
Javascript :: number vs bigint js 
Javascript :: js how to sort array by object value 
Javascript :: index and id together angularjs 
Javascript :: angular autofocus 
Javascript :: mongoose encrypt database using mongoose encryption package 
Javascript :: convert days to weeks and days javascript typescript 
Javascript :: how to take yes or no in js 
Javascript :: adding data attributes to react-select 
Javascript :: java script to send email 
Javascript :: Hide ReactTooltip after hover off 
Javascript :: automated counter with react hooks 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =