Nitesh Mishra
Nitesh Mishra

Reputation: 574

set input type key value from jquery

Hello everyone i am trying to set key value for input type jquery but i am getting this function.upload.js?v=1.x:26 Uncaught SyntaxError: missing ) after argument list really tried everything but could not find the solution

 form.append('<input type="hidden" name="policy" value="'s3Policy['inputs']['policy']'" />');

here s3Policy['inputs'] is an array. please help me solving this error. Sorry for asking such a basic question.

Upvotes: 0

Views: 230

Answers (2)

Rezwana
Rezwana

Reputation: 132

You missed the concatenation from your value attribute

Here is the solution:

form.append('<input type="hidden" name="policy" value="'+ s3Policy['inputs']['policy'] +'" />');

Upvotes: 2

&#214;zg&#252;r Ersil
&#214;zg&#252;r Ersil

Reputation: 7013

try this with the right unwrap

form.append('<input type="hidden" name="policy" value="' + s3Policy["inputs"]["policy"] + '" />');
//                                               here ^^^^^^                 and here ^^^^^^

Upvotes: 2

Related Questions