티스토리 뷰

프로그래밍/script언어

jQuery Template

앙망 2011. 5. 17. 17:17
배열이나 객체같은 JavaScript type 데이타를 HTML 또는 텍스트로 작성된 템플릿과 함께 간편하게 렌더링 할 수 있는 자바 스크립트이다.
http://api.jquery.com/template-tag-tmpl/


  • version added: 1.4.3
    {{tmpl( [data], [options] ) template}} content {{/tmpl}}

    templateThe HTML markup or text to use as a template.

    dataThe data to render. This can be any JavaScript type, including Array or Object.

    optionsAn optional map of user-defined key-value pairs. Extends the tmplItem data structure, available to the template during rendering.

이 데이타를

[

{"team":"홍길동", "wins":96, "losses":66},

{"team":"나 똥꼬진이야", "wins":15, "losses":97},

{"team":"삼식아~아 이놈 삼식아~", "wins":89, "losses":73}

];


jQuery 템플릿을 사용하여
TeamWin Loss PCT
홍길동96 66 0.593
삼식아~아 이놈 삼식아~89 73 0.549
나 똥꼬진이야15 97 0.134
로 보여준다.
  • jQuery Template 관련 Plug-in 설정하기
  • HTML 작성
  • jQuery Template 작성
  • jQuery Template 사용하기
	

jQuery Template plugin 사용하기

Team Win Loss PCT
댓글