Can I assign an identifier for Twitter Bootstrap downloads?

I was able to get Twitter Bootstrap popups to show, but is there a way to assign them an id when creating so that I can manipulate them?

Here is my code: .js

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

.html

 <a id='test-button' rel='popover'> 
+8
twitter bootstrap
Sep 28 '12 at 1:13
source share
2 answers

There are several options you could use to get the popover element:

1) Modify the Boostrap Popover to accept the id property in the parameter object and paste it into the template (line: 102)

2) Set the html property in the popover option using an identifier, for example.

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

and then access the popover container through

 var testPopover = $('#test-popover-content').parent().parent(); 
+8
Jun 21 '13 at 4:26
source share

The easiest way is to specify a template with the desired identifier.

The basic HTML code used to create the popover.

The popover header will be entered in the .popover header.

Popover content will be injected into .popover-content.

.arrow will become a popover arrow.

The outer shell element must have a .popover class.

Here's the default template value:

  '<div class="popover" role="tooltip"> <div class="arrow"></div>ΒΈ <h3 class="popover-title"></h3> <div class="popover-content"></div> </div>' 

And you can use it like this:

 $(#your-pop-over).popover({ template:'<div id="your-id" class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' }); 
+1
Dec 01 '15 at 21:59
source share



All Articles