我希望當用戶點擊#email-form div時,它會被隱藏,並且#stamp會再次顯示。我試圖用覆蓋div來做到這一點,但它不工作。jQuery點擊OUT overlay
jQuery('#email-form').hide();
jQuery('#stamp').click(function() {
jQuery(this).hide();
jQuery('#email-form').show();
jQuery(
});
jQuery('.overlay').click(function() {
jQuery('#email-form').hide();
jQuery('#stamp').show();
});
-------------------------- -------- HTML ------------------------------
<div class="overlay" style="width:100%; height:100%;"></div>
<div id="stamp"><img src="email_postmark.png"/></div>
<div id="email-form">
<form id="signup" action="<?=$_SERVER['PHP_SELF']; ?>" method="get">
<span id="response">
<?php require ('store-address.php'); if($_GET['submit']){ echo storeAddress(); } ?>
</span>
<input type="text" name="email" id="email" placeholder="TYPE EMAIL & PRESS ENTER"/>
</form>
</div>
下面是一個替代的想法:綁定一個事件處理程序到'document.onclick' - 然後停止傳播到#email-form的所有點擊。 – Niko 2012-04-02 15:47:15