Visualizzazione dei risultati da 1 a 3 su 3

Discussione: [jquery] ritornare id

  1. #1

    [jquery] ritornare id

    Perche una cosa del genere non funziona? mi dovrebbe ritornare l'id di ogni elemento di classe commento.

    codice:
    $(document).ready(function(){
    $(".commento").each(function(i){
     alert ($(this).attr(’id’));
    })
    
    });

  2. #2
    Codice PHP:
    $(".commento").each(function(i){   
    alert ($(this).attr('id'));  }) 
    il problema sono attr(’id’)

    ci vogliono o ' o "

    + veloce

    Codice PHP:
    $(".commento").each(function(i){      
    alert (this.id);  
    }) 
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  3. #3
    Grazie mille ora funziona

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.