I have a JavaScript / Jquery method that updates a PartialView and there is a div with an associated fadeToggle
fault.
JavaScript in Onload (to associate FadeToggle) (It works)
$("#ComentarioAba").click(function () {
$("#Comentario").fadeToggle(500);
});
JavaScript method:
function ReloadComentarios() {
$('#Comentarios').empty();
$('#Comentarios').load(document.URL + ' #ComentarioAba');
$("#ComentarioAba").click(function () {
$("#Comentario").fadeToggle(500);
});
}
HTML code
<div id="Comentarios">
<div id="ComentarioAba" class="col-md-12 mwTituloArea">
<p>Comentários </p>
</div>
<div id="Comentario" class="col-md-12">
<div class="col-md-12 ">
...
</div>
</div>
</div>
It turns out that after the ReloadComentarios
method is executed, fadeToggle
no longer works. Even the association being redone within the method itself.
Why does this occur?