250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- keyframes
- hover
- 프론트엔드
- 개발자
- effect
- front-end
- jQuery
- 풀스택
- MAC
- iPhone
- php
- 비전공자
- HTML
- ipad
- 자바스크립트
- css3
- 백엔드
- SWIFT
- 비전공 개발자
- image
- xcode
- 애니메이션
- Animation
- javascript
- html5
- react
- iOS 개발자
- button
- CSS
- IOS
Archives
- Today
- Total
비전공자 개발일기
JQuery - input & button Event 본문
728x90
SMALL
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4544051457126963"
crossorigin="anonymous"></script>
</head>
<body>
<table class="type_2">
<colgroup>
<col width="10%">
<col width="10%">
<col width="10%">
<col width="15%">
<col width="46%">
<col width="10%">
</colgroup>
<thead>
<tr>
<th>No</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D/th>
<th>E</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>X</td>
<td>Y</td>
<td>Z</td>
<td>
<span class="memo_span">XYZ</span>
<input type="text" style="display: none;" name="cs_memo" id="memo_input" value="<?=$row['cs_memo']?>">
<input type="hidden" name="cs_idx" id="memo_idx" value="<?=$row['cs_idx']?>">
</td>
<td>
<button style="width : 100px; height: 40px;" type="button" class="cs_btn orange_btn_f63 memo_write">수정</button>
<button style="width : 100px; height: 40px; background-color: #cc3433; display: none;" type="button" class="cs_btn orange_btn_f63 memo_save">저장</button>
</td>
</tr>
</tbody>
</table>
<script>
$(function(){
// 상담 메모 수정
$(".memo_write").click(function(event) {
$(this).parent().parent().find('#memo_input').css('display','block');
$(this).parent().parent().find('.memo_span').css('display','none');
$(this).parent().parent().find('.memo_write').css('display','none');
$(this).parent().parent().find('.memo_save').css('display','block');
// $('#memo_input')
// $('.memo_span').css('display','none');
// $('.memo_write').css('display','none');
// $('.memo_save').css('display','block');
});
// 상담메모 저장
$(".memo_save").click(function(event) {
var db_idx = "<?=$_GET['db_idx']?>";
var cs_idx = $(this).parent().parent().find('#memo_idx').val();
var cs_memo = $(this).parent().parent().find('#memo_input').val();
$.post('/경로', {db_idx: db_idx,cs_idx: cs_idx,cs_memo: cs_memo}, function(data, textStatus, xhr) {
alert(data.returnMsg);
location.reload();
});
});
});
</script>
</body>
</html>
728x90
LIST
'JQuery' 카테고리의 다른 글
Dynamic Select Option (0) | 2022.05.04 |
---|---|
Conditional Statements in jQuery (0) | 2022.01.08 |
JQuery - sortable (0) | 2021.12.27 |
JQuery 17 - datepicker (0) | 2021.12.24 |
Serialize - input name에 해당 되는 값들 추출 (0) | 2021.12.18 |