답변 4개 / 댓글 5개
채택된 답변
+20 포인트
참고 예제 코드입니다.
Copy
<input type="text" id="txt_num"> <button type="button" id="btn_go">이동</button>
<script>
$(function() {
$('#btn_go').on('click', function() {
go_url = "http://seaferry.co.kr/" + $(this).val() + ".php";
location.href = go_url;
});
});
</script>
답변에 대한 댓글 4개
수정 코드입니다. $(this).val() -> $('#txt_num').val()
[code]
<input type="text" id="txt_num"> <button type="button" id="btn_go">이동</button>
<script>
$(function() {
$('#btn_go').on('click', function() {
go_url = "http://seaferry.co.kr/" + $('#txt_num').val() + ".php";
location.href = go_url;
});
});
</script>
[/code]
[code]
<input type="text" id="txt_num"> <button type="button" id="btn_go">이동</button>
<script>
$(function() {
$('#btn_go').on('click', function() {
go_url = "http://seaferry.co.kr/" + $('#txt_num').val() + ".php";
location.href = go_url;
});
});
</script>
[/code]
답변을 작성하려면 로그인이 필요합니다.
