테스트 사이트 - 개발 중인 베타 버전입니다

select box 컨트롤

· 9년 전 · 346

// [ select box 컨트롤 ] --------------------------------------------------------------/// 

// 셀렉트박스 초기화        
//SelectBox 애완동물중 고양이 값 선택하기.
$("#ANI").val('2');
$("#ANI>option[value='2']").attr("selected", true);
//또는 옵션그룹이 있는Select Box 인경우
$("#ANI> optgroup >option[value='2']").attr("selected", true);
 
//선택된 값 읽어오기
$("#ANI option:selected").val();
$("select[name=ANI]").val();
 
//선택된 값 삭제
$('#ANI option:selected').remove();
 
//SelectBox 애완동물중 고양이 삭제
$("#ANI option[value='2']").remove();    
  
jQuery("#ElementID").is(":checked")
 
if(jQuery("#ElementID").is(":checked"))  
{
     체크된 상태
}
else
{
    체크가 해제된 상태
}
 
select box의 내용 가져오기
$("#select_box > option:selected").val();
select box의 값 설정
 $("#select_box > option[value=지정값]").attr("selected", "true");

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

게시글 목록

번호 제목
12281
20386
12280
12279
12278
12277
12276
12275
12274
12273
12272
12260
360
12258
12257
12256
12255
12253
12252
12251
12250
12249
12248
12247
12246