을,
$(document).ready(function() {
$(".yourLinkClass").click(function() { // or "#yourLinkId" for that matter
$("#registerForm").submit();
});
});
그리고 당신은 또한 제출 버튼을 사용할 수 jQuery를하지 않고 : document.getElementById(....).submit()
또는 링크 정상의 jQuery 방법으로 링크에 이벤트를 제출 자바 스크립트 전용 제출을 사용하십시오, 왜 자바 스크립트 오류가있을 경우 사용할 수 없도록 양식을 설정 했습니까?
제출 양식의 표준 양식 입력을 사용하여 ID를 제공하고 필요에 따라 자바 스크립트를 통해 제출 양식 또는 텍스트를 변경 한 다음 onclick & onsubmit 이벤트를 해당 기능 상단에 레이어로 만들고 false를 반환하도록합니다. . 더 나은 폴백.
난 당신이 한 번에 두 가지 형태로 제출하려는 이유를 잘 모르겠지만, 방법이 대안 (I이 코드를 테스트하지 않았습니다 참고하지만 생각을 전달한다)에 대한 :
<script type='text/javascript'>
$('#fallback-register-submit').hide(); // Hide the submit button.
$('#registration-link').show().click(function(){ // Show the link and attach the action.
$('#registerForm').submit();
return false; // Don't bother following the link anchor.
});
</script>
<form name="registerForm" id="registerForm" target="_blank" action="paypal_url" method="post""><!-- Single form that does all of the submitting. -->
...
...
<input type='submit' id='fallback-register-submit'>Register</input><!-- In the event of a javascript error for their browser, they can still buy your stuff! -->
<a id='registration-submit' style='display:none'>Go to paypal and send confirmation mail</a>
</form>
'onsubmit'은'submit()'을 사용할 때 해고되지 않습니다. – pimvdb