답변 3개 / 댓글 2개
채택된 답변
+20 포인트
Copy
<form>
<input type="text" id="t_sample">
</form>
<script>
$("#t_sample").keydown(function (e) {
if (e.keyCode == 13) {
f_sample();
e.preventDefault();
}
});
function f_sample() {
alert('!!');
}
</script>
Copy
<script>
function fchk(frm) {
// return confirm('confirm or cancel');
var cf = confirm('confirm or cancel');
if (cf == true) {
alert('confirm');
return true;
} else {
alert('cancel');
return false;
}
}
</script>
<form onsubmit="return fchk(this)">
<input type="text" name="txt">
</form>
답변을 작성하려면 로그인이 필요합니다.