Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16
  1. #1

    Aiuto jQuery - Recuperare i valori di campi di form

    Salve. Qualcuno mi dice come faccio con jQuery ad accedere agli elementi di un form? Ad esempio, come faccio a recuperare il testo di un input di tipo text? Ho provato a cercare su internet con scarso successo...

  2. #2

    Re: Aiuto jQuery - Recuperare i valori di campi di form

    Originariamente inviato da Dreamer89
    Salve. Qualcuno mi dice come faccio con jQuery ad accedere agli elementi di un form? Ad esempio, come faccio a recuperare il testo di un input di tipo text? Ho provato a cercare su internet con scarso successo...

    Codice PHP:
    $('tuoinput').val() 

    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  3. #3

    Re: Re: Aiuto jQuery - Recuperare i valori di campi di form

    Originariamente inviato da whisher
    Codice PHP:
    $('tuoinput').val() 

    Grazie. E se volessi leggere il contenuto di un

    o un <div>?

  4. #4
    Dimenticavo: ora ho utilizzato l'input specificando il suo ID. Ma se volessi specificare solo il suo "name"?

  5. #5
    Codice PHP:
     $("input[@name=bar]").val(); 

    http://docs.jquery.com/DOM/Traversing/Selectors


    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  6. #6
    Originariamente inviato da whisher
    Codice PHP:
     $("input[@name=bar]").val(); 

    http://docs.jquery.com/DOM/Traversing/Selectors


    Allora, ho definito un input text con name = nick ed l'errore che viene lanciato quanto tento di richiamare alert ($('input[@name=nick]').val());:

    "Errore: uncaught exception: Syntax error, unrecognized expression: [@name=nick]"

    Perchè?

  7. #7
    Codice PHP:
    $(function(){
    alert($('input[@name=nick]').val());
    }); 
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  8. #8
    Originariamente inviato da whisher
    Codice PHP:
    $(function(){
    alert($('input[@name=nick]').val());
    }); 
    Mi da lo stesso errore...

  9. #9
    Originariamente inviato da Dreamer89
    Mi da lo stesso errore...
    ma hai incluso jquery perchè il
    codice funziona senza problemi.
    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  10. #10
    Originariamente inviato da whisher
    ma hai incluso jquery perchè il
    codice funziona senza problemi.
    Eh?

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.