0

I have this code :

$('#location').html(location);
$('#temperature').append(temperature);
$('#temperature').attr("value", temperature);
$('#weather').html(weather);
$('#summary').html(summary);
$('#hourly').html(hourly);

I want make description for every word show in html . like this $('#hourly').html(hourly) + 'next 24 hours' but when make like that not showing describe next 24 hours .

dotnetom
  • 24,551
  • 9
  • 51
  • 54
ALI GHASSAN
  • 221
  • 1
  • 4
  • 13

2 Answers2

0

If you want to add some additional text, you need to use the same html function to add it:

$('#hourly').html(hourly + 'next 24 hours');
dotnetom
  • 24,551
  • 9
  • 51
  • 54
0

Ok, so this: $('#location').html(location); looks for a variable called "location" so it can put its contents in an HTML element with the id="location" attribute.

If you type it like this: $('#location').html('location'); the string "location" will be inserted in the element with the "location" id.

You can combine any number of variables, strings and functions being executed as parameters: $('#location').html('Current Location: ' + location); (assuming the "location" variable contains the data for the current location).

If you want to display the current time, there is a post about the Date(); function that can help you do that: Current time formatting with Javascript

Community
  • 1
  • 1