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

select box 컨트롤

· 9년 전 · 343

// [ 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");

댓글 작성

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

로그인하기

게시글 목록

번호 제목
12463
12462
12461
12460
12459
12458
12457
12456
12455
12454
12453
12452
12451
12450
12449
12448
12447
12446
12445
12444
12443
12442
12441
12440
12439