I am developing an app where users can post. I want to make it so that when a post's id is hashed in the url, the post flashes. To accomplish this, here is my code:
function getHash() {
var hash = window.location.hash;
return hash;
}
if (getHash()) {
$(getHash()).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
}
Now, I know this code is run b/c if I put an alert('in the if statement');, it works whenever there is a hash in the url. I also know this part works:
$(getHash()).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
because if I run it in the console, the post flashes. What is going wrong that is not allowing this to work?
if (getHash()) {line.