javascript - .show() not working correctly -


i having issues app creating. depending on whether variable of mine null supposed show specific screen. once variable has value attached app supposed display div. however, code not working. take @ javascript/jquery below:

(note modifying code in order show null not issue)

access_token = 3;      if (access_token == 3){         $('.dashboardprofile').hide();         $('.dashboardinfo').hide();         $('.dashboardconnect').show();      $('.connect').click(function () {         var url = "https://foursquare.com/oauth2/access_token";         url += "?client_id=" + foursquareapi.clientid;         url += "&response_type=token";         url += "&redirect_uri=" + foursquareapi.redirecturl;          window.location = url;     }); } else {     $('.dashboardprofile').show();     $('.dashboardinfo').show();     $('.dashboardconnect').hide(); } 

and html in question:

<div class="dashboard-container">     <div class="dashboardconnect">         <div class="connect">             <p>sign in</p>         </div>     </div>     <div class="dashboardprofile">         <p>user information , picture</p>     </div>     <div class="dashboardinfo">         <p>check ins</p>         <div class="indicator checkin">#</div>         <p>countries</p>         <div class="indicator country">#</div>         <p>cities</p>         <div class="indicator city">#</div>     </div> </div> </div> <!--container-fluid--> 

this head of html:

<head>     <title>foursquare dashboard</title>     <link rel="stylesheet" href="main.css">     <script src="http://code.jquery.com/jquery-latest.min.js"></script>     <script src="foursquarejax.js"></script> </head> 

easy fix. made small typo. put $('.dashboardconnect').hide(); inside else loop:

var access_token = 3; if (access_token == 3) {            $('.dashboardprofile').hide();        $('.dashboardinfo').hide();      $('.dashboardconnect').show();        $('.connect').click(function() {            var url = "https://foursquare.com/oauth2/access_token";         url += "?client_id="+foursquareapi.clientid;         url += "&response_type=token";         url += "&redirect_uri="+foursquareapi.redirecturl;         window.location = url;     }); } else {     $('.dashboardprofile').show();        $('.dashboardinfo').show();     $('.dashboardconnect').hide(); } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -