Page 2 of 2

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

Posted: Fri Oct 19, 2012 4:57 pm
by maxkatz

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


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

Posted: Fri Oct 19, 2012 5:14 pm
by Emmz

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


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

Posted: Fri Oct 19, 2012 5:17 pm
by Emmz

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


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

Posted: Sat Oct 20, 2012 1:18 pm
by Kevin

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.


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

Posted: Sat Oct 20, 2012 1:29 pm
by Emmz

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..


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

Posted: Sat Oct 20, 2012 1:29 pm
by Emmz

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


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

Posted: Sun Oct 21, 2012 7:39 am
by Kevin

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