jQuery select 주무르기

jQuery로 선택된 값 읽기
[code language=”javascript”]
$(“#selectBox option:selected”).val();
$(“#select_box > option:selected”).val();
$(“select[name=name]”).val();
$(“selectBox”).val(); -> 요것도 나옵니다.
[/code]
jQuery로 선택된 내용 읽기

$("#selectBox option:selected").text();

선택된 위치

var index = $("#test option").index($("#test option:selected"));



// Add options to the end of a select, 맨 뒤에 추가
$("#selectBox").append("<option value='1'>Apples</option>");
$("#selectBox").append("<option value='2'>After Apples</option>");

// Add options to the start of a select, 맨 앞에 추가
$(“#selectBox”).prepend(“<option value=’0′>Before Apples</option>”);

// Replace all the options with new options
$(“#selectBox”).html(“<option value=’1′>oranges</option><option value=’2′>Oranges</option>”);

// Replace items at a certain index
$(“#selectBox option:eq(1)”).replaceWith(“<option value=’2′>apples</option>”);
$(“#selectBox option:eq(2)”).replaceWith(“<option value=’3′>bananas</option>”);

// 지정된 index 값으로 select 하기
$(“#selectBox option:eq(2)”).attr(“selected”, “selected”);

// text 값으로 select 하기
$(“#selectBox”).val(“Some oranges”).attr(“selected”, “selected”);

// value 값으로 select 하기
$(“#selectBox”).val(“2”);
$(“#selectBox > option[@value=지정값]”).attr(“selected”, “true”);

// 지정된 인덱스 값의 item 삭제
$(“#selectBox option:eq(0)”).remove();

// 첫번째 item 삭제
$(“#selectBox option:first”).remove();

// 마지막 item 삭제
$(“#selectBox option:last”).remove();

// 선택된 옵션의 text 구하기
alert($(“#selectBox option:selected”).text());

// 선택된 옵션의 value 구하기
alert($(“#selectBox option:selected”).val());

// 선택된 옵션 index 구하기
alert($(“#selectBox option”).index($(“#selectBox option:selected”)));

// SelecBox 아이템 갯수 구하기
alert($(“#selectBox option”).size());

// 선택된 옵션 앞의 아이템 갯수
alert($(“#selectBox option:selected”).prevAll().size());

// 선택된 옵션 후의 아이템 갯수
alert($(“#selectBox option:selected”).nextAll().size());

// 0번째 item 다음에 삽입
$(“#selectBox option:eq(0)”).after(“<option value=’4′>Some pears</option>”);

// 3번째 item 전에 삽입
$(“#selectBox option:eq(3)”).before(“<option value=’5′>Some apricots</option>”);

// select box 값이 변경될때 선택된 현재값
$(“#selectBox”).change(function() {
alert($(this).val());
alert($(this).children(“option:selected”).text());
});

출처 및 참조 : http://blog.daum.net/twinsnow/124

주제별 영어 단어 – 주택

A. Outside of a House (주택외부의 명칭)
1. garage차고 2. driveway저택내의 차도 3. lamppost가로등 4. sidewalk보도 5. fence울타리 6. gate정문 7. steps현관계단 8. porch현관,차대는 곳 9. lawn잔디 10. roof지붕 11. chimney굴뚝 12. antenna안테나

B. Inside of a House (주택내부의 명칭)
1. attic다락방 2. closet옷장 3. stairs계단 4. laundry room세탁실 5. nursery아이방,육아실 6. hall,foyer현관의 홀 7. basement지하실 8. workshop작업실

C. Kinds of Houses (주택의 종류)
1. adobe house벽돌조의 주택 2. mansion저택 3. town house연립주택 4. mobile home이동주택 5. apartment building 6. ranch house목장주의 주택

D. Housework(집안일)과 관련된 동사
1. scrub문지르다 2. rub닦다 3. polish광내다,윤을 내다 4. shine빛내다 5. wipe닦다,씻다 6. sweep쓸다,청소하다 7. brush솔질하다 8. dust먼지를 털다 9. vacuum진공청소기로 청소하다 10. mow(풀,잔디)베다 11. fix고정시키다,고치다 12. tighten꽉 죄다 13. repair수리하다

E. 건축
1. house – household가족,세대 housing주택(공급) housekeeper주부,가정부
2. build – builder건축업자 rebuild재건하다
3. construct세우다,건설하다 – contruction건설,건축 constructive건설적인
4. architect건축가,건축하다 – architecture건축술 architectural건축의,건축상의
5. synthesize종합하다,합성하다 – synthesis종합,합성 synthetic종합적인

F. 거주
1. reside살다,거주하다 – residence주택,주거 resident거주자 residential주거의
2. dwell살다,거주하다 – dweller거주자 dwelling주소
3. inhabit살다,거주하다 – inhabitable거주할 수 있는 inhabitant주민
4. habitat서식지,거주지 – habitation거주지,주소 habitant주민,거주자