javascript - Bootstrap tooltip on radio input - Stack Overflow

This code does not work. Also tried without JS, by putting attributes into <input>. Nothing seems

This code does not work. Also tried without JS, by putting attributes into <input>. Nothing seems to work.

$('#radio1').tooltip({
    placement: "bottom",
    trigger: "hover"
});
<link rel="stylesheet" href=".3.6/css/bootstrap.min.css">

<div class="btn-group" data-toggle="buttons">

    <label class="btn btn-primary active">
        <input type="radio" name="options" id="radio1" autoplete="off" 
            data-toggle="tooltip" title="tooltip on radio!">Radio 1
    </label>

    <label class="btn btn-primary">
        <input type="radio" name="options" id="radio2" autoplete="off">Radio 2
    </label>

</div>

<script src=".11.3/jquery.min.js"></script>
<script src=".3.6/js/bootstrap.min.js"></script>

This code does not work. Also tried without JS, by putting attributes into <input>. Nothing seems to work.

$('#radio1').tooltip({
    placement: "bottom",
    trigger: "hover"
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn./bootstrap/3.3.6/css/bootstrap.min.css">

<div class="btn-group" data-toggle="buttons">

    <label class="btn btn-primary active">
        <input type="radio" name="options" id="radio1" autoplete="off" 
            data-toggle="tooltip" title="tooltip on radio!">Radio 1
    </label>

    <label class="btn btn-primary">
        <input type="radio" name="options" id="radio2" autoplete="off">Radio 2
    </label>

</div>

<script src="https://ajax.googleapis./ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn./bootstrap/3.3.6/js/bootstrap.min.js"></script>

Share Improve this question edited Jul 7, 2016 at 19:51 Gleb Kemarsky 10.4k7 gold badges46 silver badges71 bronze badges asked Jul 7, 2016 at 18:33 ProgZiProgZi 1,2674 gold badges17 silver badges30 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Try to apply tooltip's attributes to the <label>:

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn./bootstrap/3.3.6/css/bootstrap.min.css">

<div class="btn-group" data-toggle="buttons">

  <label class="btn btn-primary active" data-toggle="tooltip" data-placement="bottom" title="tooltip on radio!">
    <input type="radio" name="options" id="radio1" autoplete="off">Radio 1
  </label>

  <label class="btn btn-primary">
    <input type="radio" name="options" id="radio2" autoplete="off">Radio 2
  </label>

</div>

<script src="https://ajax.googleapis./ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn./bootstrap/3.3.6/js/bootstrap.min.js"></script>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742339723a4425376.html

相关推荐

  • javascript - Bootstrap tooltip on radio input - Stack Overflow

    This code does not work. Also tried without JS, by putting attributes into <input>. Nothing seems

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信