user3608168
user3608168

Reputation: 111

How to set Bootstrap data-container to particular ID

I tried to make a Bootstrap popover. For that I have written the following code as per the 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. I found in the Bootstrap documentation that I can control through the data-container attribute.

  data-container="#anotherDivId"

Actually I want to append the popover content to specific div ("anotherDivId") instead of appending to body.

I failed with my idea so can anyone help me.

Thanks.

Upvotes: 9

Views: 20656

Answers (1)

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

Upvotes: 11

Related Questions