Javascript $(';#hourly';).html(hourly)的说明
我有以下代码:Javascript $(';#hourly';).html(hourly)的说明,javascript,jquery,Javascript,Jquery,我有以下代码: $('#location').html(location); $('#temperature').append(temperature); $('#temperature').attr("value", temperature); $('#weather').html(weather); $('#summary').html(summary); $('#hourly').html(hourly); 我想让每一个字的html显示说明。像这样$('#hourly').html(ho
$('#location').html(location);
$('#temperature').append(temperature);
$('#temperature').attr("value", temperature);
$('#weather').html(weather);
$('#summary').html(summary);
$('#hourly').html(hourly);
我想让每一个字的html显示说明。像这样$('#hourly').html(hourly)+“下一个24小时”
但当这样做时,请不要描述接下来的24小时 如果您想添加一些额外的文本,您需要使用相同的
html
函数来添加它:
$('#hourly').html(hourly + 'next 24 hours');
好的,这是:$('#location').html(location)
查找一个名为“location”的变量,以便将其内容放入具有id=“location”
属性的HTML元素中
如果您这样键入:$('#location').html('location')代码>字符串“location”将插入到具有“location”id的元素中
您可以将任意数量的变量、字符串和正在执行的函数组合为参数:$('#location').html('Current location:'+location)代码>(假设“location”变量包含当前位置的数据)
如果要显示当前时间,则会有一篇关于日期()的帖子;可以帮助您实现这一目标的功能: