라디오 버튼 선택해서 셀렉트 박스 컨트롤

2018. 4. 19. 12:16Javascript/Javascript+jQuery

반응형
<div class="row">
<h5>주차가능 여부</h5>
<div class="col-lg-2">

<div class="pdsm">
<label class="control radio">
<input type="radio" name="is_parking_possible" class="add-contrast" value="1" onclick="showParkings('parkings', 'parkingszero', this);">
<span class="control-indicator"></span>주차가능
</label>
</div>
</div>
<div class="col-lg-2" id="noParking">
<div class="pdsm">
<label class="control radio">
<input type="radio" name="is_parking_possible" class="add-contrast" value="0" onclick="showParkings('parkingszero', 'parkings', this);">
<span class="control-indicator"></span>주차불가
</label>
</div>
</div>
</div>





<!--  주차가능 대수 -->
<div class="row" id="parkings" style="display:none">
<div class="col-lg-6">
<h5>주차가능 대수</h5>
<div class="pdsm">
<select name="parking_possible_count">
<option value="1">1대</option>
<option value="2">2대</option>
<option value="3">3대</option>
<option value="4">4대</option>
<option value="5">5대</option>
</select>
</div>
</div>
</div>

<div class="row" id="parkingszero" style="display:none">
<div class="col-lg-6">
<h5>주차가능 대수</h5>
<div class="pdsm">
<select name="parking_possible_count">
<option value="0">불가</option>
</select>
</div>
</div>
</div>





function showParkings(id, text, btn) {

console.log('parkings');

document.getElementById(id).style.display = 'block';
// hide the lorem ipsum text
document.getElementById(text).style.display = 'none';
// hide the link
btn.style.display = 'none';


}


반응형