JavaScript: Creating inline DOM objects

Honestly, it’s been a long time since I touch any javascripts but they still remain fun and powerful for me. Recently I came across a situation that I need to create some DOM objects using javascript. After a little search, I found out that it’s exactly how JSON objects are created:

var myObj =
[{
  title: 'My Object',
  dataList:
  [
    {name: 'data 1', value: 'value 1'},
    {name: 'data 2', value: 'value  2'}
  ]
}]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s