1. 程式人生 > >jquery多條件選擇器

jquery多條件選擇器

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
<meta charset="utf-8" />
    <script src="jquery-3.3.1.js"></script>
    <script>
        $(function () {


            $('#btn').click(function () {
                $('p,strong,div.cls').css('backgroundColor', 'orange');

            })
        })
    </script>
</head>
<body>
    <input type="button" name="name" value="效果" id="btn"/>
    <p>這是p</p>
    <strong>這是strong</strong>
    <div class="cls" style="width:50px;height:50px">


    </div>
    <div style="width:300px;height:200px;background-color:yellow">


    </div>
</body>
</html>