maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Make a button disabled / not visible for users not logged in

I don't know.. I'd check on jQuery Mobile docs/forum whether it's possible.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Make a button disabled / not visible for users not logged in

Kevin.
Try This..
code
$("[dsid='mobilenavbaritem2']").addClass('ui-disabled');//Disable
/code
This will disable nav bar item(button) 2.
If u renamed navbar buttons. Use your name in place of mobilenavbaritem2

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Make a button disabled / not visible for users not logged in

This works on almost any button on the screen. Header, footer, navbar, no matter...

Kevin
Posts: 0
Joined: Sun Oct 07, 2012 7:58 pm

Make a button disabled / not visible for users not logged in

All the codes to disable the buttons work perfectly when i remove the "if statement" for checking the sessiontoken stored in the local storage.

So I'm guessing the problem is with checking if the sessiontoken variable is empty.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Make a button disabled / not visible for users not logged in

var session = localStorage.getItem('sessionToken');
Show the value with alert (session);
This will tell u if there is a value.
If localstorage was never set sessionToken it will be null value. And ur If statment will fail..

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Make a button disabled / not visible for users not logged in

R u using chrome? Use deleloper tools to show localstorage etc.

Kevin
Posts: 0
Joined: Sun Oct 07, 2012 7:58 pm

Make a button disabled / not visible for users not logged in

Thanks Neil got it working there was some syntax error on my code.

Return to “Issues”