I am faced with a JSON containing two keys, "cars" and "others". How can I implement a toggling feature on my website using HTML/CSS/JavaScript such that:
- Clicking on "cars" displays the car items (small vehicle, large vehicle) in red text.
- Clicking on "others" hides the car items and displays the other items in blue text.
Please note: The toggle button or link should function properly for switching between the two options.
{
"cars": {
"items": ["small-vehicle", "large-vehicle"],
"color": "red"
},
"others": {
"items": ["swimming pool", "plane", "ship"],
"color": "blue"
}
}