jquery1.9学习笔记 之层级选择器(三)

下一个相邻选择器(“prev + next”)

 

描述:选择所有给出祖先选择器的子孙选择器。

 

例子:

<!doctype html>

<html lang='zh'>

    <head>

        <meta charset='utf-8'>

        <title>next adjacent demo</title>

        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>

    </head>

    <body>

        <form>

            <label>Name:</label>

            <input name='name'/>

            <fieldset>

                <label>Newsletter:</label>

                <input name='newsletter'/>

            </fieldset>

        </form>

        <input name='none'/>

        <script>

            $("label + input").css("color", "blue").val("Labeled!");

        </script>

    </body>

</html>

原文地址:https://www.cnblogs.com/semcoding/p/3295509.html