jq 写法

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="jquery-1.11.2.js"></script>
<script>
$(function ()
{
    $('#div1').css('background','red');
    $('#div1').click(function ()
    {
        $(this).html('hello');
    })
    
    $('li').filter('[title = box]').css('background','green');
    $('#div1').attr('title','123');
})
</script>
<title>无标题文档</title>
</head>

<body>
<div id="div1">div1</div>
<ul>
    <li>1</li>
    <li title="box">2</li>
    <li title="box">3</li>
    <li>4</li>
</ul>
</body>
</html>
原文地址:https://www.cnblogs.com/mayufo/p/4303439.html