bind("submit") Dans div display:none
Bonjour à tous,
J'essai d"utiliser SuperBox, (bon pluging Jquery) mais je n'arrive pas a faire fonctionner un formulaire.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>jQuery SuperBox!</title>
<link rel="stylesheet" href="jquery.superbox.css" type="text/css" media="all" />
<link rel="stylesheet" href="styles/demo.css" type="text/css" media="all" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript" src="http://pierrebertet.net/projects/jquery_superbox/jquery.superbox-min.js"></script>
<script type="text/javascript">
$(function(){
$("#login_form").bind("submit", function() {
alert('Chaî de caractès');
if ($("#email").val().length < 1 || $("#passwd").val().length < 1) {
$("#login_error").show();
$.superbox.resize();
return false;
}
$.ajax({
type : "POST",
cache : false,
url : "connexion.php",
data : $(this).serializeArray(),
success: function(data) {
parent.location.reload(true);
}
});
return false;
});
$.superbox.settings = {
closeTxt: "Fermer",
loadTxt: "Chargement..."
};
$.superbox();
});
</script>
</head>
<body>
<div id="container">
<h1>jQuery Super<span>Box!</span></h1>
<div id="mode-content">
<p><a href="#boxlogin" rel="superbox[content]">Se connecter</a></p>
</div>
<div style="display:none" id="boxlogin">
<div class="popconnexion" style="width:200px; float:left; border-right: 1px solid ;margin-right:20px;">
<form id="login_form" name="login_form" method="post" action="" class="niceform">
<p id="login_error">Merci</p>
<input type="hidden" name="action" value="add">
<fieldset>
<legend>Connexion</legend>
<label for="email">Email</label><br />
<input type="text" name="email" id="email" size="30px" /><br />
<label for="passwd">Mot de passe</label><br />
<input type="password" name="passwd" id="passwd" size="30px" />
<br>
<input type="hidden" name="action" value="cnx" />
<br>
<input type="submit" class="button1" value="Connexion" />
</fieldset>
</form>
</div>
</div>
</body>
</html> |
Si j’enlève le display:none sur boxlogin, le script de connexion fonctionne très bien.
Je pense avoir a peux près tout testé :( là je n'ai plus d'idée.
Merci