【发布时间】:2015-03-16 20:52:13
【问题描述】:
我在数组中有一些十六进制颜色。
$.each(["#FF0000", "#000", "#FF6600", "#00E641"], function(i, c) {
$('<input class="btns" type="button">')
.css("background-color", color)
.on("touch", $.proxy(funcNew, null, color))
.appendTo("#subDv");
});
我想将颜色情绪与十六进制值一起传递。我该怎么做?
["Red", "Black", "Orange", "Soft Shade"]
例如:
when #FF0000 is selected I want to be able to pass the word Red.
when #FF6600 is selected I want to be able to pass the word Orange.
【问题讨论】:
-
使用对象?
[{ hexValue: "#FF0000", name: "Red"}, { hexValue:"#000", name:"Black" }]
标签: javascript jquery multidimensional-array