R: Re: [Web2.0] Jquery (sono all'inizio)

diego.unali a fastwebnet.it diego.unali a fastwebnet.it
Mer 11 Lug 2007 10:23:07 CEST



>----Messaggio originale----
>Dal: simonevolpini a yahoo.it
>Data: 11/07/2007 9.19
>A: "ML dedicata ad Ajax, CSS etc"<web2.0 a lists.ziobudda.net>
>Ogg: Re: [Web2.0] Jquery (sono all&#39;inizio)
>
>Simone Volpini wrote:
>> P.S: Toggle, ad una prima occhiata da neofita, non sono sicuro faccia al
>> caso mio.
>
>Cambiato idea, direi che Toggle fa al caso mio :)
>
>Praticamente lo uso cosi:
>
> $("a").toggle(function(){
>   alert('prova 1');
> },function(){
>   alert('prova 2');
> });
>
>http://www.c--s.net/ajax/index3_table.php
>
>
>Solo che io vorrei far cambiare il link "STATO" in base al suo effettivo
>stato (attivo, disattivo), ma nel momento in cui sostituisco il
>contenuto del link
>
>$("a").toggle(function(){
>   alert('prova 1');
>   $("#att_1 > #test").empty();
>   $("#att_1 > #test").append('<strong><a>ON</a></strong>');
> },function(){
>   alert('prova 2');
> });
>
>devo rifare il bind di "a" (in questo caso il toggle se non sbaglio).
>
>Il problema è che nel momento in cui riclicco nuovamente sullo stesso
>record e cambio lo stato devo nuovamente rifare il bind (e cosi via in
>maniera ricorsiva):
>
>$("a").toggle(function(){
>    alert('prova 1');
>    $("#att_1 > #test").empty();
>    $("#att_1 > #test").append('<strong><a>ON</a></strong>');
>    $("a").toggle(function(){
>        alert('prova 1');
>        $("#att_1 > #test").empty();
>        $("#att_1 > #test").append('<strong><a>OFF</a></strong>');
>        $("a").toggle(function(){
>            alert('prova 1');
>            $("#att_1 > #test").empty();
>            $("#att_1 > #test").append('<strong><a>ON</a></strong>');
>        },function(){
>            alert('prova 2');
>        });
>    },function(){
>        alert('prova 2');
>    });
>},function(){
>    alert('prova 2');
>});
>
>
>che ovviamente è assurdo! :)
>C'e' sicuramente un altro metodo che non conosco.
>Intanto continuo a googolare, ma se avete qualche idea, sono ben accette ;)
>
>Grazie,
>Simone
>_______________________________________________
>Web2.0 mailing list
>Web2.0 a lists.ziobudda.net
>http://lists.ziobudda.net/mailman/listinfo/web2.0
>

io proverei a fare una cosa del tipo

$("a").toggle(function(){
    $("#att_1 > #test strong a").html('ON');
},function(){
    $("#att_1 > #test strong a").html('OFF');
});


Maggiori informazioni sulla lista Web2.0