This was an answer to how to remove a script tag that was dynamically added. 😧
var flag1=0,flag2=0;
$(window).resize(function()
{
if ($(window).width() < 480)
{
flag1++;
console.log(flag1);
flag2=0;
}
else
if($(window).width() > 480)
{
flag2++;
console.log(flag2);
flag1=0;
}
if(flag1==1)
{
$("body").append("<script class='abc' src='custom.js'/>");
}
else
if(flag2==1)
{
$(".abc").remove();
}
});
No comments:
Post a Comment