184
rated 0 times
[
191]
[
7]
/ answers: 1 / hits: 31165
/ 10 Years ago, fri, june 27, 2014, 12:00:00
The error message: Cannot read property 'style' of null shows up on the first statement of my else statement. Not sure where I am going wrong. Any thoughts?
$(document).ready(function () {
var foursquareApi = {
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
redirectUrl: http://almontas.github.io/FourSquareJax/
}
if (access_token === 0) {
document.getElementById('dashboardProfile').style.display == 'none';
document.getElementById('dashboardInfo').style.display == 'none';
$('.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 {
document.getElementById('dashboardProfile').style.display == 'block'; //this lines gives an error message.
document.getElementById('dashboardInfo').style.display == 'block';
}
Here is some of the HTML in question. The .dashboardProfile and .dashboardInfo seem to be in place as mentioned by comments.
<body>
<div class=container>
<div class=header>
<div class=logo><img src = images/foursquare-logo.png>
</div>
</div>
<div class=dashboard-container>
<div class=dashboardConnect>
<div class=connect><p> Sign In </p>
</div>
</div>
<div class=dashboardProfile>
<p>User Information and 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-->
More From » jquery