<script> var class_hide; var user_id = 'test'; if(user_id){ class_hide = '<div style="display:inline" >'; }else{ class_hide = '<div style="display:none" >'; } alert(class_hide); </script>