[RESOLU]Show()/Hide() qui ne marchent plus

Par Manal Aba, il y a 11 ans


Bonjour, j'ai ajouté un script show/hide à mon formulaire d'ajout en fonction du radio button sélectionné et ça marchait très bien sauf que là je ne sais plus où est le problème.J'ai effacé le script et fais un simple hide()

<script>
$(document).ready(function(){ 
$("#champ_name").hide();
});
</script>

<!-- cakePHP -->
<h3>
            Create New Ticket Type
          </h3>

                <?php
                    echo $this->Form->create(false);
                    echo "<div id = 'champ_name'>";
                    echo $this->Form->input('TicketType.name', array('type' => 'text','div' => false, 'label' =>'Ticket Name', 'class' => 'form-control', 'placeholder' => 'Nom du ticket'));
                    echo "</div>";

                    echo $this->Form->submit('Enregistrer', array(
                        'class' => 'btn btn-secondary btn-block btn-lg', 
                        'div' => array(
                            'class' => 'form-group',
                            )
                        ));
                    echo $this->Form->end();
                ?>

Et le champ en question apparaît toujours sur mon formulaire.

==MERCI

4 réponses

Romano83, il y a 11 ans

As-tu bien chargé jQuery ? Parce que chez moi, ça fonctionne parfaitement avec ton code ;)

Manal Aba, il y a 11 ans

On fait comment pour charger le jQuery?

Romano83, il y a 11 ans

Tu mets une balise script avec en source le lien vers jquery.
Exemple :

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> // import depuis google
<script type="text/javascript" src="lien vers un fichier jQuery"></script> // import depuis un dossier sur ton serveur
Manal Aba, il y a 11 ans

ah merci! je venais juste de trouver! :p merci beaucoup !!