Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to assign an id to a Twitter Bootstrap popover?

I've been able to get the Twitter Bootstrap popovers to show but is there a way to assign id's to them on creation so I can manipulate them?

Heres my code so far: .js

$('#test-button').popover({content:'test.', trigger:'click'});
$('#test-button').popover('show');

.html

<a id='test-button' rel='popover'>
like image 609
perseverance Avatar asked Sep 28 '12 01:09

perseverance


1 Answers

There are a couple of options you could use to get the popover element:

1) Modify Boostrap Popover to accept an id property on the options object and inject that into the template (line: 102)

2) Set the html property on popover options using an id e.g.

$('#test-button').popover({html: true, content: '<div id="test-popover-content">... </div>'})

and then access the popover container via

var testPopover = $('#test-popover-content').parent().parent();
like image 196
Neil Avatar answered Oct 23 '22 16:10

Neil