html form inside bootstrap popover not working

前端 未结 3 1674
小蘑菇
小蘑菇 2021-01-19 04:55

I\'m trying to use a form inside a bootstrap popover. Some basic html works (text styling, buttons), but the form does not. (neither do onclick() javascript actions)

3条回答
  •  走了就别回头了
    2021-01-19 05:29

    Your HTML is just fine and works (see example below.) The issue is a new flag needs to be set to allow HTML in the popover for BS 4.3.1

    Per their release notes for that version is a breaking change:

    "Security: Fixed an XSS vulnerability (CVE-2019-8331) in our tooltip and popover plugins by implementing a new HTML sanitizer"

    See implementation of sanitize below in your example:

    $(function() {
      $('[data-toggle="popover"]').popover({
        html: true,
    sanitize: false,
      })
    })
    
    
    
    
    
    
    
    
    
    
    
    
    

提交回复
热议问题