jQuery | javascript | CSS

34.jQuery - Is ( 04.Traversing - 02.Is)

Godffs 2009. 11. 11. 10:10
반응형
is("") : 지정된 선택기와 맞는 요소 검색

02.Is.htm

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>지정된 표현식이 있는지 없는지 검사</title>

    <script src="../jQuery/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function() {

            //myForm 영역에 submit 버튼이 있는지 검사

        if ($('#myForm').children().is("input[type=submit]")) {

                alert("있다.");

            }

            else {

                alert("없다");

            }

        });

    </script>

</head>

 

<body>

    <div id="myForm">

        <input type="text" />

    </div>

</body>

</html>


결과화면

[그림34-1]



반응형