jquery - Delete all javascript from ajax modal on close/hidden -


i'm making website music , lyrics. when song playing users can click on lyrics button , modal live lyrics appears.

if click lyrics 1 song works perfect close modal , click on lyrics of song overlap both lyrics.

this because javascript previous modal still in code.

how can delete data including javascript when modal hidden/closed.

 <div>    <a id="lyrics" href="" data-toggle="ajaxmodal"  title="lyrics">      <i class="fa fa-list-alt"></i>    </a>  </div> 

sorry bad english :$

using pure js, can use .innerhtml method clear contents of object. example:

<div id="scripts"><script>//your scripts here</script></div>

then

var oscripts = document.getelementbyid("scripts"); oscripts.innerhtml = "";

but don't think work scripts, because once script loaded doesn't matter if delete dom.

removing script tag specific content using jquery

hope can you.

also, can try using different method names or calling method different parameters, if storing lyrics on variable can try clean it.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -