jquery change - if > jQuery / Script

본문 바로가기
gnb bg


jQuery / Script

jQuery / Script

jquery change - if

본문

$('#select_port_view').change(function(){

var myID = $(this).find('option:selected').attr("class");


//$('.new_view_blk').each(function(){

// myID === $(this).attr('id') ? $(this).show() : $(this).hide();

//});


if (myID == 'ping_view') {

//alert('a');

$("#wellknown_view").hide();

$("#default_view").show().prop('disabled',true);

} else if (myID == 'wellknown_view') {

$("#wellknown_view").show();

$("#default_view").hide();

} else {

$("#wellknown_view").hide();

$("#default_view").show().prop('disabled',false);

}


});






<input type="text" name="" class="input_ty_03" placeholder="항목 이름" title="항목 이름 입력를 입력해 주세요." style="width:150px" />

<select name="" id="select_port_view" class="select_ty_01" title="프로토콜 유형 선택" style="width:150px" >

<option value="TCP" class="default_view" selected="">TCP</option>

<option value="UDP" class="default_view" >UDP</option>

<option value="PING" class="ping_view">PING</option>

<option value="Well-known" class="wellknown_view">Well-known Port</option>

</select>

<input type="text" name="" id="default_view" class="input_ty_03" placeholder="포트번호" title="포트번호 입력를 입력해 주세요." style="width:100px" />

<select name="" id="wellknown_view" class="new_view_blk select_ty_02" title="Well-known Port 유형 선택" style="width:150px" >

<option value="" selected="">Well-known 1111</option>

<option value="" >Well-known 22</option>

<option value="">Well-known 3</option>

<option value="">Well-known 4444</option>

</select>

댓글목록

등록된 댓글이 없습니다.


Copyright 2005-2020 UNIDA_v7. All rights reserved.