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 :

recuperer le texte dans un class


Sujet :

jQuery

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Invité
    Invité(e)
    Par défaut recuperer le texte dans un class
    Bonjour à tous
    Voila j'utilise jquery actuellement et comme vous pourrez le voir dans le code après plusieurs span ayant la même classe je cherche à les récupérer dans un tableau or
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $('.ui-state-default').html();
    Ne me donne que le 1er class et je cherche à tous les mettre dans un tableau.
    Merçi d'avance pour votre aide
    Le code interessant se trouve à partir de la ligne 54
    Code html : 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
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
     
    <div class="ui-datepicker-inline ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" style="display: block">
    <div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">
    <a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="Prev">
    <span class="ui-icon ui-icon-circle-triangle-w">Prev</span>
    </a>
    <a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_1309192955749.datepicker._adjustDate('#dp1309192955750', +1, 'M');" title="Next">
    <span class="ui-icon ui-icon-circle-triangle-e">Next</span>
    </a>
    <div class="ui-datepicker-title">
    <span class="ui-datepicker-month">Juillet</span>
    <span class="ui-datepicker-year">2011</span>
    </div>
    </div>
    <table class="ui-datepicker-calendar">
    <thead>
    <tr>
    <th class="ui-datepicker-week-end">
    <span title="Lundi">Lu</span>
    </th>
    <th>
    <span title="Mardi">Ma</span>
    </th>
    <th>
    <span title="Mercredi">Me</span>
    </th>
    <th>
    <span title="Jeudi">Je</span>
    </th>
    <th>
    <span title="Vendredi">Ve</span>
    </th>
    <th>
    <span title="Samedi">Sa</span>
    </th>
    <th class="ui-datepicker-week-end">
    <span title="Dimanche">Di</span>
    </th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">1</span>
    </td>
    <td class=" ui-datepicker-week-end ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">2</span>
    </td>
    </tr>
    <tr>
    <td class=" ui-datepicker-week-end ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">3</span>
    </td>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default ui-state-active ui-state-hover">4</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">5</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">6</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">7</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">8</span>
    </td>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">9</span>
    </td>
    </tr>
    <tr>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">10</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">11</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">12</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">13</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">14</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">15</span>
    </td>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">16</span>
    </td>
    </tr>
    <tr>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">17</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">18</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">19</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">20</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">21</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">22</span>
    </td>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">23</span>
    </td>
    </tr>
    <tr>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">24</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">25</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">26</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">27</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">28</span>
    </td>
    <td class=" ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">29</span>
    </td>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">30</span>
    </td>
    </tr>
    <tr>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled ">
    <span class="ui-state-default">31</span>
    </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    <td class=" ui-datepicker-week-end ui-datepicker-other-month ui-datepicker-unselectable ui-state-disabled"> </td>
    </tr>
    </tbody>
    </table>
    </div>
    Dernière modification par Invité ; 29/06/2011 à 00h57.

  2. #2
    Expert confirmé
    Avatar de Watilin
    Homme Profil pro
    En recherche d'emploi
    Inscrit en
    Juin 2010
    Messages
    3 100
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : En recherche d'emploi

    Informations forums :
    Inscription : Juin 2010
    Messages : 3 100
    Par défaut
    Bonsoir,

    tu ne peux pas itérer implicitement avec la méthode .html(). Il faut donc le faire explicitement, avec .map() :
    Code JS : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    $('.ui-state-default').map(function(){
       return $(this).html();
    });

    La FAQ JavaScript – Les cours JavaScript
    Touche F12 = la console → l’outil indispensable pour développer en JavaScript !

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

Discussions similaires

  1. recuperer un texte dans un tableau ?
    Par id.prog dans le forum Collection et Stream
    Réponses: 9
    Dernier message: 22/02/2008, 11h18
  2. recuperation de texte dans un editbox
    Par Fred_Climber dans le forum C++
    Réponses: 2
    Dernier message: 19/02/2008, 18h11
  3. Recuperer du "texte" dans un jTexfield
    Par norkoffire dans le forum AWT/Swing
    Réponses: 2
    Dernier message: 19/06/2007, 14h05
  4. Récupérer les textes dans CppWebBrowser1?
    Par Xavier dans le forum C++Builder
    Réponses: 3
    Dernier message: 02/08/2006, 15h15
  5. recuperer champs texte dans variable session via javascript
    Par richton95 dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 10/03/2006, 14h17

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