Note that there are some explanatory texts on larger screens.

plurals
  1. POBootstrap popover semi-manual toggle
    primarykey
    data
    text
    <p>I have an element</p> <pre><code>&lt;span id="1"&gt;Element&lt;/span&gt; </code></pre> <p>and made it as popover enabled element by initializing bootstrap popover using javascript</p> <pre><code> $('#how2').popover({ html:true, placement:"right", trigger:"click", content:"somecontent", title:"sometitle", }); </code></pre> <p>Then in "somecontent", I have a <code>&lt;script&gt;&lt;/script&gt;</code> whose content is</p> <pre><code>$(".popover-close-button").click(function(){ $(this).parent().parent().remove(); //remove the .popover element }); </code></pre> <p>whose function is giving a click listener to a X (close) button defined in "sometitle" to remove the whole ".popover" element created. </p> <p>Toggle works. If <code>id="1"</code> element is clicked, it shows the popover. When it is clicked again, popover hides. The problem comes when the X button is clicked. The popover does hide (removed actually), but, when <code>id="1"</code> element is clicked to make the popover shows up, nothing happens. A popover will only shows up at the <strong>second click</strong>. </p> <p>I will be happy to know why such thing happens. Does bootstrap make use of global javascript variable to determine the on/off status of the popover?</p> <p>Note: <code>$(this).parent().parent().remove();</code> is chosen over <code>$("#1").popover("hide")</code> for a DRY purpose. The content loaded inside popover is expected to be used in other places also. Therefore, putting "#1" there, is unacceptable.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload