Pure Rhymer Organization Pure Rhymer Organization - 1 year ago 54
jQuery Question

PHP session and hide table with jQuery

Is it possible to hide the table with jQuery if their is session present?

this is my session code

$username = $this->session->userdata('username');
if($username == TRUE){
echo "WELCOME ".$username;
echo "<div class='msg'>Please Log In</div>";

and in my jQuery I dont know what to put in IF statement so I put it like this


If possible I want to hide the table using jQuery

Answer Source

You can do using jQuery try below code

if ($(".msg").length > 0) {