IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

jQuery Discussion :

bind("submit") Dans div display:none


Sujet :

jQuery

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    71
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 71
    Points : 72
    Points
    72
    Par défaut 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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    71
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 71
    Points : 72
    Points
    72
    Par défaut jQuery
    Version encore plus simple mais que ne fonctionne pas ;

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    <!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="http://pierrebertet.net/projects/jquery_superbox/jquery.superbox.css" type="text/css" media="all" />
    	<link rel="stylesheet" href="http://pierrebertet.net/projects/jquery_superbox/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>
    </head>
    <body>
    		<p><a href="#boxlogin" rel="superbox[content]">Se connecter</a></p>
     <div 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" />
            <input type="submit" class="button1" value="Connexion" />
          </fieldset>
        	</form>
        </div>
    </div>
    	<script type="text/javascript">
    	 $(function(){
            $("#login_form").bind("submit", function() {
                 alert('yes');
          });
      			$("#boxlogin").hide();
          	$.superbox();
       });
     
    	</script>
    </body>
    </html>
    Merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. CL editor et div display none
    Par marcetienne dans le forum jQuery
    Réponses: 3
    Dernier message: 14/10/2014, 19h18
  2. [Form][DIV] display:none request.getParam() null
    Par Stessy dans le forum Servlets/JSP
    Réponses: 0
    Dernier message: 11/02/2011, 10h37
  3. DIV display none block
    Par kishkaya dans le forum Mise en page CSS
    Réponses: 4
    Dernier message: 08/08/2007, 17h07

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo