I have the following variable:
var cars = [
{model: "BMW", count: 23, details: "<p>I like <b>X6</b> from Germany</p>"},
{model: "Hyundai", count: 30, details: "<p>I have <b>Verna</b> from Korea</p>"},
{model: "Toyota", count: 08, details: "<p>Small <b>Yaris</b> from Japan</p>"},
{model: "Fiat", count: 12, details: "<p>Latest <b>500c</b> from Italy</p>"}
]
What I'm trying to do is, create a table with only 3 columns, that display only Model and count like so 'BMW(23)', then when I click on 'BMW' only it opens an HTML page which shows 'details'.
I have looked at How do I create HTML table using jQuery dynamically? but I'm not able to achive the requrienment:
- The list should always be displayed in a three column layout, also in the case of, for instance, only four models in total.
- List should be ordered alphabetically.
- Clicking on each car, model should display additional information about the car (some html) as listed above.
- The number of cars in the list can vary at any moment.
Thanks...