JavaScript Bootstrap popover is closing when click inside bootstrap popover close button,bootstrap popover not closing,prevent bootstrap

I have a bootstrap popover and its content is a kendo Ui color picker widget.

When you click in the color picker widget, the popover close even if the trigger option is set to focus.

Why? How to keep the popover open until a click is made outside the popover?

<a id="popover" target='_blank' href="#">Color Picker</a>

var $kendoColorPicker = $("<div></div>").kendoFlatColorPicker({
    value: "#ffffff"
});

$("#popover").popover({
    container: "body", 
    content: $kendoColorPicker, 
    html: true, 
    placement: "bottom", 
    trigger: "focus"
});

See a live demo here : jsfiddle

Answer:1

Here's a slightly simplified and generalized version of user1119279's answer:

jQuery(function ($) {
  $("[data-toggle='popover']").popover({trigger: "click"}).click(function (event) {
    event.stopPropagation();

  }).on('inserted.bs.popover', function () {
    $(".popover").click(function (event) {
      event.stopPropagation();
    })
  })

  $(document).click(function () {
    $("[data-toggle='popover']").popover('hide')
  })
})

This version also preserves the behaviour where clicking multiple times on the trigger button toggles the popover.

Answer:2

A different approch:

function getContent() {
  console.log("getContent");
  return $("<div></div>")
    .kendoFlatColorPicker({
    value: "#ffffff"
  }).click(function(event) {
    event.stopPropagation();
  });
}

$("#popover").popover({
    container: "body",
    content: getContent,
    html: true,
    placement: "bottom",
    trigger: "manual"}
).click(function(event) {
  $("#popover").popover('show')
  event.stopPropagation();
})

$(document).click(function() {
  $("#popover").popover('hide')
})

jsFiddle

but for some reason the slider does not work

I think you should use an alternative solution (for example "spectrum")

Answer:3

I am using the Ionic framework to build an android app. I have a form as such: <form action='https://secure.payu.in/_payment' method="POST" target="..."> ...... </form> Is there a way ...

I am using the Ionic framework to build an android app. I have a form as such: <form action='https://secure.payu.in/_payment' method="POST" target="..."> ...... </form> Is there a way ...

  1. change formula
  2. change format
  3. change formula excel
  4. change formula to value
  5. change format of date in excel
  6. change format of picture
  7. change formatter vscode
  8. change formula google sheets
  9. change format of date in r
  10. change formatting in word
  11. change format of datetime python
  12. change format of date in sql
  13. change form template
  14. change format of outlook
  15. change format to pdf
  16. change form synonym
  17. change form real estate hawaii
  18. change format of pivot table
  19. change format sas
  20. change form action jquery

Beginning JavaScript learner here... I'm working through Adrian Neumann's Simple Programming Problems and my question is about number 5 in the elementary exercises. Write a program that asks the ...

Beginning JavaScript learner here... I'm working through Adrian Neumann's Simple Programming Problems and my question is about number 5 in the elementary exercises. Write a program that asks the ...

  1. compare contents array javascript
  2. javascript array contents equal
  3. javascript array contents
  4. javascript array contents to string
  5. javascript array contents disappear

I am trying to insert a simple img tag into the editor. jQuery('<img />').attr('src', '/uploads/images/' + res.data.filename); jQuery('.summernote').summernote('insertNode', $image[0]); I ...

I am trying to insert a simple img tag into the editor. jQuery('<img />').attr('src', '/uploads/images/' + res.data.filename); jQuery('.summernote').summernote('insertNode', $image[0]); I ...

I'm trying to implement nested components in Ember 2.0.1, but I'm getting a strange behavior when use toggleProperty function inside of the action handler. The first component looks like: // ./...

I'm trying to implement nested components in Ember 2.0.1, but I'm getting a strange behavior when use toggleProperty function inside of the action handler. The first component looks like: // ./...