Make a div show or hide

Make a div show or hide

Hi

I have a HTML page. I want to check if the user is a manager then show a div otherwise hide it.
When I check the Console for the page
$("#CFMainContentFrameset").attr("data-userrole")
This shows correct role.

In my code, I have
 if ($("#CFMainContentFrameset").attr("data-userrole") == "MANAGERNOCOMP") {
   $("#PersonalDetail").hide();}

But it does not work.

I removed the if to check if this part   $("#PersonalDetail").hide() works. And it does.

But when I put it in the if , it does not.

I am just learning jQuery.

Would you please help me?

Thank you