• 쇼핑몰
  • 커뮤니티
  • 북마크

JAVASCRIPT

Email Select Jquery 선택 스크립트

익명
2019.12.09 16:05 6,144 0

본문

<div>

<label class="contentlabel"> 사용자 이메일 </label>

<input class="" id="email1" type="text" class="box">

<input class="" id="email2" type="text" class="box">

<select id="emailSelection" name="emailSelection">

<option value="1" selected="selected">직접입력</option>

<option value="gmail.com">gmail.com</option>

<option value="naver.com">naver.com</option>

<option value="hanmail.net">hanmail.net</option>

</select>

<button type="button" class="btn btn-success" id="sendContact">완료</button>

<button type="button" class="btn btn-warning" id="cancelContact" onclick="javascript:history.back()">취소</button>

</div>


<script>

$(function(){

$(document).ready(function(){

$('select[name=emailSelection]').change(function() {

if($(this).val()=="1"){

$('#email2').val("");

} else {

$('#email2').val($(this).val());

$("#email2").attr("readonly", true);

}

});

});

});

</script>

댓글목록 0

등록된 댓글이 없습니다.