JQUERY/함수

css, val, attr, mouseenter 이벤트까지.

나이많은 초보 2022. 8. 28. 17:33
<body>
    <h1>입력 양식 선택자</h1>
    텍스트 상자: <input type="text"> <br>
    버튼 : <input type="button" value="버튼"> <br>

    체크박스 : <input type="checkbox" name="" id=""> <br>
    파일선택 : <input type="file" name="" id=""><br>
    이미지 : <input type="image"
    src="../FRONT_HTML_CSS/WebContent/img/dog-g559b26e85_1920.jpg"
    alt="" width="500px" height="300px"> <br>

    <script>
        $(function(){
            $('input:text').css('background','lemonchiffon');

            $('input:button').val('짱크게!')
                             .css({width : '100px',
                                    'height':'100px'});
            $('input:checkbox').attr('checked',true);
            $('input:file').css('background','yellow');
            $('input:image').mouseenter(function(){
                $(this).attr('src','#');
            });
            $('input:image').mouseout(function(){
                $(this).attr('stc','#');
            });
        });
    </script>