Two forms in Jquery slider validation problem
I am using a jquery slider and in the slider I have two forms. when a user selects form number one, the link will be like this: www.webx.com/form-test.asp#1 and when they select form two the link will be www.webx.com/form-test.asp#2 . So basically the ID in the url changes depending on the form selected. Now I would like to create a jquery or javascript validation depending on what form the user had selected. So if the user selects form one (www.webx.com/form-test.asp#1) the validation only works on form number 1. Form 1 and 2 got different fields as well... Form 1 got txtname and txtsurname and form 2 got txtname, txtsurname, txtaddress... Any help please? THANKS
<form action="https://www1.gotomeeting.com/en_US/island/webinar/registration.flow" method="post" id="formElem1" name="formElem1" autocomplete='off'>
<input type="hidden" name="Template" value="https://www1.gotomeeting.com/island/webinar/registration.tmpl">
<input type="hidden" name="Form" value="webinarRegistrationForm">
<input type="hidden" name="WebinarKey" value="782136264">
<input type="hidden" name="ViewArchivedWebinar" value="false">
<input type="hidden" name="registrant" value="">
<tr>
<td>
<label for="Name_First">First Name:</label></td><开发者_如何学编程td>
<input type="text" name="Name_First" id="Name_First" value="" class="required" maxlength="128" /></td>
</tr>
<tr>
<td>
<label for="Name_Last">Last Name:</label></td><td>
<input type="text" name="Name_Last" id="Name_Last" value="" class="required" maxlength="128" /></td>
</tr>
<tr>
<td>
<label for="Email">Email Address:</label></td><td>
<input type="text" name="Email" id="Email" value="" maxlength="128" /></td>
</tr>
<tr>
<p class="submit">
<button id="registerButton" type="submit">Register</button></td>
</tr>
</form>
</table>
$( 'form#form1' ).submit(function(){
var error = false;
var msg = '';
if( $( '#form1 #inputname' )=='' ){ error=true; msg='Please insert a name.<br />'; }
/* etc */
if( error ){
$( '#msg' ).html( msg );
return false;
}
});
/* same for #form2 */
精彩评论