what’s the best way to show form elements in bootstrap tooltip?

Use the sanitize option in tooltips, set as false

$(document).ready(function() {
  var html = '<div><select><option>option1</option><option>option1</option><option>option1</option><option>option1</option><option>option1</option></select></hr><input type="text"/></hr><input type="radio" name="abc"/><input type="radio" name="abc"/><input type="radio" name="abc"/><input type="radio" name="abc"/><input type="radio" name="abc"/><input type="checkbox"/></div>';

  $('#example').tooltip({
    title: html,
    html: true,
    placement: "bottom",
    sanitize: false
  });
});
<div class='list-items'>
  <span id="example">Test Div</span>
</div>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top