$(document).ready(function(){
var url = "https://fcc-weather-api.glitch.me/api/current?";
var api;
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(pos){
api = url + "lat=" + pos.coords.latitude + "&" + "lon=" + pos.coords.longitude;
$.getJSON(api, (function(data){
$("#loc").html(data.name + ", " + data.sys.country);
$("#temp").html(data.main.temp + "<button id='C' class='btn btn-default'><b>C</b></button>");
$("img").attr("src", "http://openweathermap.org/img/w/" + setIcon(data.weather[0].id) + ".png");
function setIcon(num){
if (200 <= num && num <= 232){
return "11d";
} else if ((300 <= num && num <= 321) || (520 <= num && num <= 531)){
return "09d";
} else if (500 <= num && num <= 504){
return "10d";
} else if (num == 511 || 600 <= num && num <= 622){
return "13d";
} else if (num == 800){
return "01d";
} else if (num == 801){
return "02d";
} else if (num == 802){
return "03d";
} else if (num == 803 || num == 804){
return "04d";
} else {
return "01d";
}
}
}));
});
}
$(".btn").css("color", "orange");
});
Why is my final jQuery statement not effecting the button after it is created in the initial function?
:cookie: 316 | @njm8 |http://www.freecodecamp.org/njm8
:cookie: 613 | @eweiss17 |http://www.freecodecamp.org/eweiss17
function getLength(str) {
"use strict";
// change code below this line
var leng = {length:str.length};
const {length:len} =leng ;
// change this
// change code above this line
return len; // you must assign length to len in line
}
console.log(getLength('FreeCodeCamp'));
Hi all, I'm having trouble positioning divs within a flex container. I want the two divs on top of each other, but they keep appearing inline. Can anyone tell my why, and how I can fix it?
what I want:
. . .
. i .
. l .
. . .
what I currently have:
. . . .
. i l .
. . . .
If anything is unclear about my question, please ask to clarify.
Uncaught TypeError: Cannot read property 'grid' of undefined
Please help!