/phone/write.skin.php 에 하기와 같이 넣으시면 됩니다.
[code]
<script>
const localAutoHyphen = (target) => {
target.value = target.value
.replace(/[^0-9]/g, '')
.replace(/^(\d{2,3})(\d{3,4})(\d{4})$/, `$1-$2-$3`);
}
const phoneAutoHyphen2 = (target) => {
target.value = target.value
.replace(/[^0-9]/g, '')
.replace(/^(\d{0,3})(\d{0,4})(\d{0,4})$/g, "$1-$2-$3").replace(/(\-{1,2})$/g, "");
}
</script>
[/code]
[code]
<div class="bo_w_tit write_div">
<label for="wr_subject" class="sound_only">지역 전화번호<strong>필수</strong></label>
<div id="autosave_wrapper" class="write_div">
<input type="text" oninput="localAutoHyphen(this)" id="wr_1" name="wr_1" class="frm_input full_input " value="<?php echo $wr_1;?>" maxlength="13" placeholder="지역 전화번호" autofocus />
</div>
</div>
<div class="bo_w_tit write_div">
<label for="wr_subject" class="sound_only">휴대 전화번호<strong>필수</strong></label>
<div id="autosave_wrapper" class="write_div">
<input type="text" oninput="phoneAutoHyphen2(this)" id="wr_2" name="wr_2" class="frm_input full_input " value="<?php echo $wr_1;?>" maxlength="13" placeholder="휴대 전화번호" autofocus />
</div>
</div>
[/code]
댓글 7개
좋은 정보 고맙습니다. :)
지역번호 02인경우 오류가 있는거 같아요.
아래처럼 고쳐보면
const localAutoHyphen = (target) => {
target.value = target.value
.replace(/[^0-9]/g, '')
.replace(/^(02|0[3-9]{1}[0-9]{1})(\d{3,4})(\d{4})$/, `$1-$2-$3`);
}
그렇네요~~수정해주셔서 감사합니다.
감사합니다.
감사합니다 ^^
좋은정보 감사합니다
좋은 정보 감사합니다.
게시판 목록
그누보드5 스킨
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 2636 | 게시판 | 8개월 전 | 634 | ||
| 2635 | 게시판 | 8개월 전 | 406 | ||
| 2634 | 게시판 | 8개월 전 | 527 | ||
| 2633 | 게시판 | 8개월 전 | 630 | ||
| 2632 | 게시판 | 8개월 전 | 455 | ||
| 2631 | 갤러리 | 8개월 전 | 1041 | ||
| 2630 | 게시판 | 8개월 전 | 473 | ||
| 2629 | 게시판 | 8개월 전 | 484 | ||
| 2628 | 게시판 | 8개월 전 | 963 | ||
| 2627 | 게시판 | 8개월 전 | 1411 | ||
| 2626 | 외부로그인 | 8개월 전 | 950 | ||
| 2625 | 최신글 |
|
8개월 전 | 920 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기