Black Bird Black Bird - 7 months ago 12
jQuery Question

jQuery Hide & Show Form

I've created a link, which when clicked on pops open and shows a "Contact Form". It opens, validates, submits & emails fine. I'm running into problems when I try to close the form.


<div id="blanket"><div id="myForm">
<p style="text-align:right; margin: 0; padding: 0;"><a href="#" id="close" onClick="onClickClose();">Close</a></p>
<table width="400" border="0" cellspacing="0" cellpadding="5"><tr><td>
<form name="form1" method="POST" action="_sendmail.php" onSubmit="return CheckAll(this);">
<input name="fieldnm_1" type="radio" value="M." /> M.
<input name="fieldnm_1" type="radio" value="Mme" /> Mme.
</td></tr><tr><td width="400">
<input name="fieldnm_2" type="text" id="left_form" placeholder="Pr&eacute;nom *" tabindex="1"/><input name="fieldnm_4" type="text" id="right_form" placeholder="Courriel *" tabindex="3"/>
</td></tr><tr><td width="400">
<input name="fieldnm_3" type="text" id="left_form" placeholder="Nom *" tabindex="2"/>
<input name="fieldnm_5" type="text" id="right_form" placeholder="T&eacute;l&eacute;phone *" tabindex="4"/>
</td></tr><tr><td width="400">
<select name="fieldnm_7" id="left_list" >
<option value="">Nombre de chambres *</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<select name="fieldnm_8" id="right_list">
<option value="">Nombre de pieds carr&eacute;s</option>
<option value="600-800">600-800</option>
<option value="800-1000">800-1000</option>
<option value="1000-1250">1000-1250</option>
<option value="Plus de 1250">Plus de 1250</option>
<textarea name="fieldnm_9" id="comment" placeholder="Commentaire*" tabindex="5"></textarea>
<input type="submit" name="Submit" value="Soumettre" tabindex="6">
<input type="reset" name="Submit2" value="Reset">


<script type="text/javascript">
onClickRegister = function(){
b = $("#blanket");
b.css("width", window.innerWidth);
b.css("height", window.innerHeight);
b.css("background-color", "rgba(0, 0, 0, 0.7)");
f.css("position", "fixed");
f.css("top", "33%");
f.css("left", "33%");
b.css("width", window.innerWidth);
b.css("height", window.innerHeight);
onClickClose = function(){

I've tried even just adding an alert to the onClickClose and nothing happens.


You can use:

function onClickClose(){

*if you don't want JQuery to save in its cache the value of the display property to be restored later (as documented here) you could use just:

function onClickClose(){