... troppo difficile definirlo nel titolo...
in pratica sto sperimentando le mie priem cosucce con jQuery e ho delle difficoltà ovvie perchè la materia mi è nuova.
Ad esempo sto facendo prove con show() e hide() ma non capisco come mai in un modo mi funziona e in un altro no..
Così funziona
codice:
$(function() {
$(\"#open\").click(function() {
$(\"#testhide\").show();
return false;
});
$(\"#close\").click(function() {
$(\"#testhide\").hide();
return false;
});
});
// l'html...
<a href=\"#\" id=\"open\">Apri</a> -<a href=\"#\" id=\"close\">Chiudi</a>
<div id=\"testhide\">
Testo testo testo testo testo testo testo testo testo testo testo
</div>
Così no...
codice:
$(function() {
$(\"#open\").click(function() {
$(\"#testhide\").show();
return false;
});
$(\"#close\").click(function() {
$(\"#testhide\").hide();
return false;
});
});
// l'html...
<a href=\"#\" id=\"open\">Apri</a>
<div id=\"testhide\">
Testo testo testo testo testo testo testo testo testo testo testo
<a href=\"#\" id=\"close\">Chiudi</a>
</div>
L'unica differenza nel secondo caso è che il "bottone" di chiusura è dentro il div "testhide".
Come mai fa così?