Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set bootstrap data-container to particular id

I tried to make bootstrap popover,for that I written the following code as per bootstrap guide.

I am using bootstrap 3.1.0.

<input id="shelfLifeField" type="text" placeholder="Use-By" class="form-control first" data-container="body" data-toggle="popover" data-placement="bottom" data-html="true" data-content="<div class='row'>this is just for text</div>"/>

it's working fine but the problem was popover content appending to body.For this I read bootstrap documentation finally I find, I can control through data-container attribute.

so I tried with the following way.

  data-container="#anotherDivId"

Actually what I am trying,I want to append popover content to specific div("anotherDivId") instead of appending to body.

I failed with my idea so can anyone help me.

Thanks.

like image 624
user3608168 Avatar asked May 13 '14 16:05

user3608168


1 Answers

data-container="#anotherDivId" is right and should work.

Be careful though that if #anotherDivId is hidden (with display:none), then the popover won't work

like image 65
Sébastien Nussbaumer Avatar answered Oct 03 '22 08:10

Sébastien Nussbaumer