jquery template를 사용할 때 다중 if문을 사용하면 화면에 아무것도 안 뜨는 경우가 있다.
이것은 문법이 달라서 그렇다.
직관적으로 우리가 아는 IF문은 다음과 같다.
{{if condition== 1}}
<td class="txt_c">1번</td>
{{else if conditionCode == 2}}
<td class="txt_c">2번</td>
{{else}}
<td class="txt_c">기타</td>
{{/if}}
다만 이렇게 하면 안된다.
문법을 찾아보니 jquery에서는 다중 if문 else if문이 달랐다.
방식은 다음과 같다.
{{if condition == 1}}
<td class="txt_c">1번</td>
{{else [condition == 2]}}
<td class="txt_c">2번</td>
{{else}}
<td class="txt_c">기타</td>
{{/if}}
즉, 두번째부터는 조건을 []으로 감싸주면 된다.
출처 : http://stackoverflow.com/questions/4989589/jquery-template-else-if-construct
'Code 해결' 카테고리의 다른 글
some characters cannot be mapped using "ISO-8859-1" character encoding (0) | 2013.12.10 |
---|---|
import cannot be resolved (0) | 2013.12.10 |
java.lang.NullPointerException (0) | 2013.08.09 |
errors occurred during the build (0) | 2013.08.03 |
ajax 데이터 한글 깨짐 (0) | 2013.08.02 |