mardi 1 décembre 2015

How to hide the login and register button after user login

What I want is hide the login and register after user login his account, but it doesn't work. Here is the HTML and JavaScript code.

<div class="u lf " id="checkviewuser">
 <span><a id="numero2" href="/RIDOApp/login.xhtml">login</a><b> | </b>
 <a id="numero1" href="/RIDOApp/registraction.xhtml">register</a>  </span>
 </div>

 <div class="lf">
 <h:outputText value="&#160;&#160;Welcome Back, #{userBean.firstName} &#160;&#160;"
 rendered="#{userBean.isLogin}"/>
 <p:commandLink value="logout" rendered="#{userBean.isLogin}" action="#{userBeanController.logout}"/></div>
 </div>
 <script type="text/javascript">
 if (('' + #{userBean.firstName} +0) == 0) {
                        $("#yhzx").hide();
                        $("#checkviewuser").show();

                    }
                    else {
                        $("#yhzx").show();
                        $("#checkviewuser").hide();
                    }
</script>




Aucun commentaire:

Enregistrer un commentaire