메뉴 건너뛰기

조회 수 7420 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
index.html

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <title>Input Counter</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
        <script src="application.js" type="text/javascript"></script>
    </head>
    <body>
        <div id="container">
            <form action="index.html" method="POST">
                <textarea></textarea>
                <span class="input-counter"></span>
                <input type="submit" id="input-submit" value="등록" />
            </form>
        </div>
    </body>
</html>


stylesheet.js

body {
    font-size: 12px;
    background: #FFF;
    color: #333;
    margin: 0;
}

#container {
    margin: 10px auto;
    width: 500px;
    padding: 10px;
    background: #CCC;
}

form {
    overflow: hidden;
    height: 100%;
}

textarea {
    display: block;
    width: 99%;
    height: 5.0em;
    margin-bottom: 0.5em;
}

span.input-counter {
    float: left;
    font-weight: bold;
    color: #000;
}

span.input-counter.disabled {
    color: #F00;
}

input#input-submit {
    float: right;
}


application.js

$(function() {
    var maxLength = 140;

    function updateInputCount() {
        var textLength = $('textarea').val().length;
        var count = maxLength - textLength;
        $('span.input-counter').text(count);
        if (count < 0) {
            $('span.input-counter').addClass('disabled');
            $('input#input-submit').prop('disabled', true);
        } else {
            $('span.input-counter').removeClass('disabled');
            $('input#input-submit').prop('disabled', false);
        }
    }

    $('textarea')
        .focus(updateInputCount)
        .blur(updateInputCount)
        .keypress(updateInputCount);
    window.setInterval(updateInputCount, 100);

    updateInputCount();
});

  1. No Image 01Mar
    by
    2014/03/01 Views 5205 

    이메일 체크하기

  2. No Image 01Mar
    by
    2014/03/01 Views 5356 

    input에 background-image 이벤트

  3. 주민등록번호 체크

  4. No Image 01Mar
    by
    2014/03/01 Views 6226 

    마우스대면 글자 없어지는 검색창

  5. No Image 01Mar
    by
    2014/03/01 Views 6494 

    check box 선택시 색상 변경

  6. No Image 01Mar
    by
    2014/03/01 Views 12017 

    [jQuery] 실시간 검색어 순위 순서대로 보여주기

  7. No Image 01Mar
    by
    2014/03/01 Views 46012 

    [jQuery] 상위부터 차례로 지역 선택하기

  8. No Image 01Mar
    by
    2014/03/01 Views 6399 

    [jQuery] 탭 메뉴

  9. jQuery 이미지 슬라이드 오버시 큰이미지 보여주기 소스

  10. No Image 01Mar
    by
    2014/03/01 Views 5785 

    (소스)jqury 롤오버 버튼 쉽게 만들기

  11. top 부분이 고정되는 슬라이딩 메뉴입니다

  12. No Image 01Mar
    by 조쉬
    2014/03/01 Views 7420 

    [jQuery] textarea 글자수 카운트

  13. No Image 01Mar
    by
    2014/03/01 Views 6220 

    클릭위치로 레이어 띄우기

  14. No Image 01Mar
    by
    2014/03/01 Views 5403 

    fckeditor 2.6.6 엄청 편해졌네

  15. No Image 01Mar
    by
    2014/03/01 Views 6897 

    자바스크립트 소수점 자리수 계산

  16. No Image 01Mar
    by
    2014/03/01 Views 5593 

    div 높이 가운데정렬

  17. No Image 01Mar
    by
    2014/03/01 Views 32584 

    javascript 인쇄 미리보기, 출력, 페이지 설정 등

  18. No Image 01Mar
    by
    2014/03/01 Views 5992 

    iframe 자동 리사이즈

  19. No Image 01Mar
    by
    2014/03/01 Views 7020 

    활용예제 : 체크박스 전체선택 전체해제 /라디오버튼

  20. No Image 01Mar
    by
    2014/03/01 Views 5434 

    자바스크립트, javascript, 간단한 파일 확장자 검사후 retur

Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved