I have 2 forms on a page. I need to separate this via input password. If the user types "1" then submit the page display 1 set of form, if "2" is the input then submit the 2nd set of the form.
Not quite sure if this is doable on Javascript or in jQuery. I'm using WordPress as a CMS. If you know a plugin that can solve the issue that would be good.
HTML:
<p>ENTER YOUR INVITATION CODE</p>
<div id="incorrect">Sorry, Try again!</div>
<input type='text' id="code"/>
<input type='button' id="buttontest" value="VERIFY"/>
<div id="JPC1">CONTENT 1</div>
<div id="JPC2">CONTENT 2</div>
SCRIPT:
$(document).ready(function(){
$("#buttontest").click(function(){
if ($('#code').val() == "1") {
$("#JPC1").show("fast"); //Slide Down Effect
$("#JPC2").hide("fast"); //Slide Down Effect
$("#incorrect").hide("fast"); //Slide Up Effect
}
if ($('#code').val() == "2") {
$("#JPC1").hide("fast"); //Slide Down Effect
$("#JPC2").show("fast"); //Slide Down Effect
$("#incorrect").hide("fast"); //Slide Up Effect
}
else {
$("#incorrect").show("fast"); //Slide Up Effect
}
});
});
STYLE:
#incorrect {display:none;} #code {color:#000;}
#JPC1, #JPC2 {display:none;}
SAMPLE FIDDLE: FIDDLE