var div = {
element:'div',
parent:'body',
style: {
width:'100px',
height:'100px',
border:'1px solid black'
}
child: {
element:'input',
type:'text',
name:'age',
value:'22'
}
}
I have an object here that defines a main div with some styling and a child input. I need to find a way to pass this object into a function which will then recursively create the corresponding DOM elements.
The main div is the parent element, and it has a child input associated with it. The styles for the main div are set dynamically based on the object definition.
Can anyone suggest how I can achieve this?