JavaScript Object Syntax error -



JavaScript Object Syntax error -

i trying assemble object form data, i'm pretty sure i'm messing syntax - here's snippet

$device1.u_data.create.nodes.[$('#device-1-ip-1').val()] = {"enabled": true}; $device1.u_data.create.nodes.[$('#device-1-ip-2').val()] = {"enabled": true}; $device1.u_data.create.nodes.[$('#device-1-ip-3').val()] = {"enabled": true}; $device1.u_data.create.nodes.[$('#device-1-ip-4').val()] = {"enabled": true};

i think must messing piece i'm trying pull form. error i'm seeing in console "syntaxerror: missing name after . operator"

anything obvious i'm missing? help much appreciated.

you attempting utilize square bracket notation access items in .nodes, have dot between "nodes" , open square bracket.

on lines should have like:

$device1.u_data.create.nodes[$('#device-1-ip-1').val()] = {"enabled": true};

notice not have dot after "nodes"

javascript

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -