Javascript 如何将h3和p添加到锚定标记
我想在锚定标记中动态添加一个header元素和两个Javascript 如何将h3和p添加到锚定标记,javascript,jquery,html,jquery-mobile,Javascript,Jquery,Html,Jquery Mobile,我想在锚定标记中动态添加一个header元素和两个标记 下面是我想要实现的代码 <a href="http://shreerangpatwardhan.blogspot.com" class= "ui-list"> <h3>Author: Shreerang Patwardhan</h3> <p><b>Description:</b> Spatial Unlimited is a Tech blog where, e
标记
下面是我想要实现的代码
<a href="http://shreerangpatwardhan.blogspot.com" class= "ui-list">
<h3>Author: Shreerang Patwardhan</h3>
<p><b>Description:</b> Spatial Unlimited is a Tech blog where, examples using Google Maps API v3 and Jquery Mobile are shared. I have tried to give back to the developer community as much as I can.</p>
<p class="ui-li-aside">Last update: April 9, 2013</p>
</a>
但是没有附加标签。输入字段有值,标签有文本内容,或者为了兼容,innerHTML
var name=“Shreerang Patwardhan”
var finalsummary=“Spatial Unlimited是一个技术博客,在这里,使用Google Maps API v3和Jquery Mobile的示例可以共享。我已经尽可能地回馈开发人员社区。”;
var finaldate=新日期().ToLocalString();
var a=document.createElement(“a”);
var h3=document.createElement(“h3”);
var p=document.createElement(“p”);
var p1=document.createElement(“p”);
var li=document.createElement(“li”);
a、 setAttribute('href',“#”);
h3.innerHTML=“作者:”+姓名;
p、 innerHTML=“Description:”+最终摘要;
p1.innerHTML=“上次更新:”+finaldate;
p1.setAttribute(“类”,“用户界面除外”);
a、 儿童(p1);
a、 儿童(p);
a、 儿童(h3);
李.儿童(a)
document.getElementById(“内容”).appendChild(li)代码>
您可以使用jQUERY:
$(document).ready(function(){
$(".ui-list").append('<h3>Author: Shreerang Patwardhan</h3><p><b>Description:</b> Spatial Unlimited is a Tech blog where, examples using Google Maps API v3 and Jquery Mobile are shared.I have tried to give back to the developer community as much as I can.</p><p class="ui-li-aside">Last update: April 9, 2013</p>');
});
$(文档).ready(函数(){
$(“.ui list”).append('作者:Shreerang Patwardhan描述:Spatial Unlimited是一个技术博客,在这里,使用Google Maps API v3和Jquery Mobile的示例可以共享。我已经尽可能多地回馈开发人员社区。上次更新:2013年4月9日
);
});
这可能工作得很好,但您从未将锚添加到任何内容`读取P也没有值Hi我正在将锚标记添加到li元素并将li添加到ui
$(document).ready(function(){
$(".ui-list").append('<h3>Author: Shreerang Patwardhan</h3><p><b>Description:</b> Spatial Unlimited is a Tech blog where, examples using Google Maps API v3 and Jquery Mobile are shared.I have tried to give back to the developer community as much as I can.</p><p class="ui-li-aside">Last update: April 9, 2013</p>');
});