Skip to content

Instantly share code, notes, and snippets.

@springcome
springcome / each.js
Created October 18, 2013 01:47
.each, jquery
// memberJob수 만큼 찾아 돌린다.
$(':input[name=memberJob]').each(function(){
console.log($(this).val());
});
// each index 사용
$(':input[name=memberJob]').each(function(index) {
console.log(index + ' : ' + $(this).val());
});
@springcome
springcome / checkbox.html
Created October 18, 2013 01:56
checkbox, jquery
<input type="checkbox" name="chk" id="chk1" value="1" />1번
<input type="checkbox" name="chk" id="chk2" value="2" />2번
<input type="checkbox" name="chk" id="chk3" value="3" />3번
@springcome
springcome / select.html
Created October 18, 2013 02:01
select, jquery
<select name="selectName" id="selectId">
<option value="1">1번</option>
<option value="2">2번</option>
<option value="3">3번</option>
</select>
@springcome
springcome / radio.html
Created October 18, 2013 02:11
radio, jquery
<input type="radio" name="rdo" value="1">1번
<input type="radio" name="rdo" value="2">2번
<input type="radio" name="rdo" value="3">3번
@springcome
springcome / change.html
Created October 18, 2013 02:15
.change, jquery
<select id="selectId">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
@springcome
springcome / not.js
Created October 18, 2013 02:21
.not, jquery
// selector를 사용할때 원하지 않는 요소를 빼는 방법으로 사용한다.
// type이 button, image를 제외한 요소를 알고자 할때는
$('#contents').not('[type=button],[type=image]').each(function(){
console.log($(this).val());
});
// input에 disabled가 아닌 요소만 알고자 할때
$('#contents').not(':input:disabled').each(function(){
console.log($(this).val());
@springcome
springcome / json.js
Created October 18, 2013 02:27
json, jquery
// json객체를 문자열로 변환
$.toJSON(object);
// json배열을 만들어 데이터 넣기
var jsonArr = {'info':[]};
jsonArr.info.push(
{'name':'kim'},
{'age':26}
);
jsonArr.info.push(
@springcome
springcome / ckeditor_base_style.js
Created October 21, 2013 00:45
CKEditor Base Style
CKEDITOR.replace('textarea', {
width : '100%',
height : '100px',
toolbar : [
[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
[ 'FontSize', 'TextColor', 'BGColor' ]
]
});
@springcome
springcome / merge.sql
Created October 21, 2013 01:47
merge into, oracle
MERGE INTO MEMBER M
USING DUAL
-- 업데이트를 할것인지 인서트를 할것인지의 조건
ON (M.MEMBER_ID = ?)
WHEN MATCHED THEN
-- 조건에 맞으면 업데이트
UPDATE SET MEMBER_UPDATE = ?
WHEN NOT MATCHED THEN
-- 조건에 맞지 않으면 인서트
INSERT (
@springcome
springcome / rank.sql
Created October 21, 2013 02:09
rank(), oracle
-- RANK
-- 순위를 정할때 같은값이 있을경우 같은 RANK값을 가지게 된다.
-- 다음 랭크는 중복된 값을 건너뛰게된다.
-- EX ) 1, 2, 2, 4, 4, 6
SELECT MEMBER_ID, MEMBER_NAME, MEMBER_GROUP_CODE
, RANK() OVER (ORDER BY MEMBER_SEQ DESC) AS RANK
FROM MEMBER
-- DENSE_RANK
-- 순위를 정할때 같은값이 있을경우 같은 RANK값을 가지게 된다.