i checked console in browser carefully.
line:
document.getelementbyid("role_show_" + $(this).attr("id").substring(7, 9)).style.display = "block";
is executed normally. when put in settimeout
this:
settimeout(function() { document.getelementbyid("role_show_" + $(this).attr("id").substring(7, 9)).style.display = "block"; }, 400);
the console displays error:
uncaught typeerror: cannot read property 'substring' of undefined
what going on here? sure other lines of code unedited.
settimeout
function made $(this)
in different scope want be. make work, save $(this)
variable before call settimeout function.
var = $(this); settimeout(function() { document.getelementbyid("role_show_" + $(this).attr("id").substring(7, 9)).style.display = "block"; }, 400);
so can access $(this)
in settimeout
function using that
basically.
Comments
Post a Comment