If a post had an answer from a deleted user, then the function would fail. That's because the element with the deleted user doesn't have a href which the script is told to find. Therefore, href is not defined.
I have also replaced the for loop (the one which looped through the users who had commented) with a jQuery $.each loop which appears to be more readable.
In addition, I have added an $.each to loop through all answers directly.
If a post had an answer from a deleted user, then the function would fail. That's because the element with the deleted user doesn't have a href which the script is told to find. Therefore,
href
is not defined.I have also replaced the
for
loop (the one which looped through the users who had commented) with a jQuery$.each
loop which appears to be more readable.In addition, I have added an
$.each
to loop through all answers directly.