如何获取popover的twitter属性参数值的属性,例如我需要获取列表项属性,即data-boothtype被用在bootstrap popover标题中?数据标题是不够的,虽然
HTML
<li class="booth" data-boothnumber="46" data-boothtype="prime" style="left: 240px; top: 30px;">46</li>
JS
$('.booth').popover({title: this.data-boothtype + "'s Booth", content: "test", placement: "right", callback:function(){ console.log(this)}});
PS: 回调函数是从Callback function after tooltip/popover is created with twitter bootstrap?
$.fn.popover.Constructor.prototype.show = function() {
tmp.call(this);
if (this.options.callback) {
this.options.callback();
}
}
测试单元
编辑 这里OK缩小:使用http://jsfiddle.net/tHHQ6/
'this.data-boothtype'甚至不是有效的JavaScript代码。首先得到最基本的东西非常重要... – elclanrs 2013-03-27 02:58:57
噢,不管怎么样,谢谢你的意见,只是调用对象的属性的想法......也许我错过了很多基础知识...... – user1076813 2013-03-27 09:50:10