1. 커서 변경
$('body').css('cursor', 'default');
$('body').css('cursor', 'wait');
2. Select Box에서 선택된 Value 찾기
$('#search_sale_pernr_s option:selected').val();
3. Table의 타이틀 Row를 제외한 모든 Row 삭제하기
$("#data_list_table > tbody").children("tr:not(:first)").remove();
4. Table의 마지막 Row 다음에 Row 추가하기
$("#data_list_table > tbody:last").append("<tr><td>값1</td></tr>");
5. innerHTML값 Setting하기
$("#id_total_price").html("<strong>값</strong>");
6. 해당 ID로 지정된 HTML 보이기/숨기기
$("#placeholder").show();
$("#placeholder").hide();
7. ID로 지정된 Form Submit 하기
$("#csf_tab_menu_form").attr("target", "_top");
$("#csf_tab_menu_form").attr("action", "/sabisung/list.jsp");
$("#csf_tab_menu_form").submit();
8. Select Box의 Option 값 확인
$("#search_sale_unit").find("option").each(function() {
alert(this.value);
});
9. Select Box의 특정 값을 가지는 Option 삭제하기
$("#csf_menu_no").find("option").each(function() {
if(this.value == "4") {
//alert(this.selected);
$(this).remove();
}
});
10. Select Box의 특정 값 이후/이전에 Option 추가하기
$("#csf_menu_no").find("option").each(function() {
if(this.value == "3") {
$(this).after("<option value=\"4\">텍스트</option>");
//$(this).before("<option value=\"4\">텍스트</option>");
return false;
}
});
11. each Loop에서의 break/continue 방법
$("#csf_menu_no").find("option").each(function() {
if(this.value == "3") {
return false; //break 의미
return true; //continue 의미
}
});
12. Select Box의 모든 Option 삭제 후 Default Option 추가하기
$("#search_sale_pernr_s").find("option").remove().end().append("<option value=\"\">::사원 선택::</option>");
13. checkbox의 전체 갯수와 선택된 갯수 구하기
- 전체 갯수 : $("input:checkbox[name=is_check]").length
- 선택된 갯수 : $("input:checkbox[name=is_check]:checked").length
- 전체 checkbox 순회하기
$("input:checkbox[name=is_check]").each(function() {
this.checked = true;
});
14. checkbox의 체크 여부 확인
if($("input:checkbox[name=complete_yn]").is(":checked")) == true) {
; //작업
}
15. Table의 특정(ID를 가지는) TR 다음에 TR Row를 추가하기
$("#table_appr_pernr > tbody").children("tr").each(function() {
if(("row_appr_pernr_" + row_no) == $(this).attr('id')) {
$(this).after("<tr><td>사비성</td></tr>");
return false;
}
});
16. Table의 특정(ID를 가지는) TR Row를 삭제하기
$("#table_appr_pernr > tbody").children("tr").each(function() {
if(("row_appr_pernr_" + row_no) == $(this).attr('id')) {
$(this).remove();
return false;
}
});
17. 숫자인지 체크
function is_number(v) {
var reg = /^(\s|\d)+$/;
return reg.test(v);
}
18. 숫자인지 체크 (-/+ 부호까지 체크)
function is_number(v) {
var reg = /^[-+]?\d+$/;
return reg.test(v);
}
19. 소수점 자리수에 맞는 숫자인지 체크 (소수점 2자리까지 체크)
function is_float_2(v) {
var reg = /^[-+]?\d+.?\d?\d?$/;
return reg.test(v);
}
20. 숫자에 콤마 추가하기 (금액단위)
function set_comma(n) {
var reg = /(^[+-]?\d+)(\d{3})/;
n += '';
while (reg.test(n))
n = n.replace(reg, '$1' + ',' + '$2');
return n;
}
댓글 7개
게시판 목록
팁게시판
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 52 | 20년 전 | 2672 | ||
| 51 |
prosper
|
20년 전 | 2320 | |
| 50 |
prosper
|
20년 전 | 2138 | |
| 49 | 20년 전 | 2152 | ||
| 48 | 20년 전 | 2294 | ||
| 47 | 20년 전 | 1911 | ||
| 46 | 20년 전 | 1915 | ||
| 45 | 20년 전 | 2110 | ||
| 44 | 20년 전 | 2356 | ||
| 43 | 21년 전 | 4560 | ||
| 42 |
prosper
|
21년 전 | 2694 | |
| 41 |
prosper
|
21년 전 | 2101 | |
| 40 | 21년 전 | 2164 | ||
| 39 | 21년 전 | 2115 | ||
| 38 | 21년 전 | 2388 | ||
| 37 | 21년 전 | 2533 | ||
| 36 | 21년 전 | 1742 | ||
| 35 | 21년 전 | 4050 | ||
| 34 | 21년 전 | 3832 | ||
| 33 | 21년 전 | 2957 | ||
| 32 |
prosper
|
21년 전 | 2861 | |
| 31 | 21년 전 | 5231 | ||
| 30 |
아우겐나이스
|
21년 전 | 4010 | |
| 29 |
아우겐나이스
|
21년 전 | 4410 | |
| 28 |
아우겐나이스
|
21년 전 | 3423 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기