Guys (and gals) what am I overlooking here. To me logically the following code with the variable bool set to false shouldn’t allow my hideMe() to run, but you’ve guessed it, it does.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var bool = false;
function hideMe(){
if (bool = true){
$("p").click(function(){
$(this).hide();
});
}
}
hideMe();
});
</script>
</head>
<body>
<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
</body>
</html>