Bootstrap小练习

点赞

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.3.0/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.3.0/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="bootstrap-3.3.7-dist\css\bootstrap.min.css">
</head>
<body>
<div>
    <button  id="btn-good" class="btn btn-success">
        <span>点赞</span>
        <span class="glyphicon glyphicon-thumbs-up"></span>
        <span id="like-value" class="badge badge-light" >0</span>
    </button>
</div>
<script>
    let $likeEle = $('#like-value');
    $('#btn-good').click(function () {
        let Num = $likeEle.text()
        Num++
        $likeEle.text(`${Num}`)
    })
</script>
</body>
</html>
posted @ 2020-05-21 21:38  Lance_王  阅读(169)  评论(0编辑  收藏  举报