How do I create a javascript control in jquery?
<p>I am using jquery library.
I have to let users create their own Cars on the browsers.  For example:
Let's say that the object model is such that a Car has a collection of wheels and a name.  Each wheel has a colour.</p>

<pre><code>var Car = new Car();
Car.Name = "BMW";
Car.Wheels = [];

var WheelR = new Wheel();
WheelR.Colour = "Blue";

var wheelL = new Wheel();
WheelL.Colour = "Green";

Car.Wheels.push(WheelR);
Car.Wheels.push(WheelL);
</code></pre>

<p>What I want to do is user to click on the button 'Create Car'</p>

<p>This will then append a div element within the body of the html form.
Within a div, there will be a textarea where user will enter the name.</p>

<p>User will then click on 'Add Wheel' button.
This will then append a div element within the car's div element.
This div will contain a combo box and user will select a colour and click on Add.</p>

<p>User can add wheels to a car at max 4 times.</p>

<p>User can then add another car on the screen.</p>

<p>I want to create a Car control and a Wheel control and have it mapped to the object model I have created above. </p>

<p>Can someone please give me some ideas and guidance?</p>

<p>​</p>
