我为qtip
工作了 /* required for qtip crests to crests */
var countyCrest = {
content: {
attr: 'id'
},
position: {
target: 'mouse',
adjust: {
mouse: true,
y: +10
}
},
style: {
classes: 'ui-tooltip-tipsy ui-tooltip-shadow',
tip: true
}
};/* end for qtip crests to crests */
我希望在每个attr:'id'之前添加“Co.”。我尝试了各种版本的
content: {
"Co. "+attr: 'id'
},
哪个不起作用。 有人能指出我正确的方向吗? TIA
答案 0 :(得分:1)
更好的是跟随:
var temp = {};
temp['Co. ' + attr] = 'id';
var countyCrest = {
content: temp,
...
}
<强> DEMO 强>
您尝试的Object
属性的字符串连接是不可能的。
content: {
attr: 'Co.id'
}
答案 1 :(得分:1)
除了事实,我看不到内容属性attr
选项(Documentation)(可能是另一个版本或其他),我想它应该是:
content: {
attr: 'Co.'+'id'
},
(id
属性中不允许使用空格)而不是
content: {
"Co. "+attr: 'id'
},
因为您不想更改选项的名称(固定attr
),而是更改它的值。