Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container-fluid text-center">
  <h1>Local Weather App</h1>
  <section id="location">
    <label id="city">Lorem</label>,&nbsp;<label id="country">Ipsum</label>
    <hr />
    <time datetime=""></time>
      <label for="" id="temperature">T</label><button id="degree" class="celsius"> °C</button>
    <h2 id="weather">
      <figure class="weather-icon">
        <img src="" alt="Weather Icon" />
<footer class="pull-right">Coded by <a href="">Bernard Pagoaga</a></footer>


                button {
  border: none;
  background: transparent;



                var APIKEY = "19ac1b3737cff28e948d4a95bbc0103a";

function getLocation() {
    if (navigator.geolocation) {    navigator.geolocation.getCurrentPosition(getWeather);
    } else {
      $('#location').html("Geolocation is not supported by this browser.");

String.prototype.capitalize = function() {
    return this.charAt(0).toUpperCase() + this.slice(1);

function calcTemp(temp){
  if( $("#degree").hasClass("celsius")){
    temp = Math.floor((temp - 32) * (5/9));
    $("#degree").html(" °C");  
    temp = Math.floor((temp * (9/5)) + 32);
    $("#degree").html(" °F");
  return temp;

function getWeather(position){
  //get lat and lon
  var lat = position.coords.latitude,
      lon = position.coords.longitude;
  $.getJSON(''+lat+'&lon='+lon+'&appid='+APIKEY, function(data){
    var tempK = data.main.temp,
        temp = Math.floor(tempK - 273.15);
    //display location
      //display weather
      $("#weather label").html([0].description.capitalize());
      $(".weather-icon img").attr('src',
};// getWeather

    var temp = $("#temperature").html();
    temp = calcTemp(temp);
    d = new Date();
    date = d.getDate() +" - "+ (d.getMonth() + 1)  +" - "+ d.getFullYear();
    return date;