Selecting from an array of element with jQuery selector
I have the following array of elements (it's quite large so I'm posting a link to pastebin):
http://pastebin.com/bM3BvD2F
and want to select the name of the image with id=2:
- alert($(allImages[id=currentID])[0].name);
- but I get the name of image with id=4 instead:
- $(allImages[id=2]): jQuery.jQuery.fn.jQuery.init[1]
- 0: Object
- allowBuyExclusive: false
- allowedPrintSize: Array[2]
- basePrise: "1000"
- collection: "Природа"
- id: 4
- imageHuge: "http://127.0.0.1:8000/media/pictures/huge_2.jpg"
- imageLarge: "http://127.0.0.1:8000/media/pictures/large_2.jpg"
- imageNormal: "http://127.0.0.1:8000/media/pictures/normal_2.jpg"
- imagePreview: "http://127.0.0.1:8000/media/pictures/preview_2.jpg"
- imageSizeRatio: "6х9"
- imageSmall: "http://127.0.0.1:8000/media/pictures/small_2.jpg"
- imageThumbnail: "http://127.0.0.1:8000/media/pictures/thumbnail_2.jpg"
- isPurchasable: true
- name: "Another pic"
- popularity: 0
- __proto__: Object
- length: 1
- __proto__: Object[0]
how can I fix this?