S
S
Smeecy Smeecy2016-08-11 16:13:52
css
Smeecy Smeecy, 2016-08-11 16:13:52

Set different id to different elements?

There is an array in Jade that displays the icons and the name of the car, now I need to set a unique id for each block (a.marks-item), how can I enter this into the array?

.block-marks
    each names in [{name:"Acura",img:"img/marks/acura.png"},{name:"Alfa Romeo",img:"img/marks/alfaromeo.png"},{name:"Audi",img:"img/marks/audi.png"},{name:"BMW",img:"img/marks/bmw.png"},{name:"Buick",img:"img/marks/buick.png"},{name:"Cadillac",img:"img/marks/cadilac.png"},{name:"Chevrolet",img:"img/marks/chevrolet.png"},{name:"Chrysler",img:"img/marks/chrysler.png"},{name:"Citroen",img:"img/marks/citroen.png"},{name:"Daewoo",img:"img/marks/daewoo.png"},{name:"Dodge",img:"img/marks/dodge.png"},{name:"Fiat",img:"img/marks/fiat.png"},{name:"Ford",img:"img/marks/ford.png"},{name:"GMC",img:"img/marks/gmc.png"},{name:"Honda",img:"img/marks/honda.png"},{name:"Hyundai",img:"img/marks/hyundai.png"},{name:"Infiniti",img:"img/marks/infiniti.png"},{name:"Isuzu",img:"img/marks/isuzu.png"},{name:"Jaguar",img:"img/marks/jaguar.png"},{name:"Jeep",img:"img/marks/jeep.png"},{name:"KIA",img:"img/marks/kia.png"},{name:"Land Rover",img:"img/marks/landrover.png"},{name:"Lexus",img:"img/marks/lexus.png"},{name:"Mazda",img:"img/marks/mazda.png"},{name:"Mercedes",img:"img/marks/mercedes.png"},{name:"Mini",img:"img/marks/mini.png"},{name:"Mitsubishi",img:"img/marks/mitsubishi.png"},{name:"Nissan",img:"img/marks/nissan.png"},{name:"Opel",img:"img/marks/opel.png"},{name:"Peugeot",img:"img/marks/peugeot.png"},{name:"Porsche",img:"img/marks/porsche.png"},{name:"Renault",img:"img/marks/renault.png"},{name:"Rover",img:"img/marks/rover.png"},{name:"Skoda",img:"img/marks/skoda.png"},{name:"SSangYong",img:"img/marks/ssangyoung.png"},{name:"Subaru",img:"img/marks/subaru.png"},{name:"Suzuki",img:"img/marks/suzuki.png"},{name:"Toyota",img:"img/marks/toyota.png"},{name:"Volvo",img:"img/marks/volvo.png"},{name:"Volkswagen",img:"img/marks/vw.png"}]
            a(href="#").marks-item
                img(src= names.img)
                =" "
                span= names.name

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Velichko, 2016-08-12
@Wekeed

[{name:"Acura",img:"img/marks/acura.png", "id": "my-id1"},{name:"Alfa Romeo",img:"img/marks/alfaromeo.png", "id": "my-id2"}]

Or use index
each names, index in [...]
a(href="#" id="#my-id#{index}").marks-item

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question