How to add a h3 and p to an anchor tag

Gopi Nath

I want to dynamically add a header element and two <p> tags inside an anchor tag.

Below is the code I want to achieve.

<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>

and below is my javascript which I am trying to make this

var a =document.createElement("a");
var h3=document.createElement("h3");
var p=document.createElement("p");
var p1=document.createElement("p");
a.setAttribute('href', "#");
h3.setAttribute('value',"Author:"+name);
p.setAttribute('value',"Description"+finalsummary);
p1.setAttribute('value',"Last update:"+finaldate);
p1.setAttribute("class","ui-li-aside");
a.appendChild(p1);
a.appendChild(p);
a.appendChild(h3);

but the tags are not getting appended.

mplungjan

Input fields have value, tags have textContent or to be compatible, innerHTML

var name="Shreerang Patwardhan"
var finalsummary ="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.";
var finaldate = new Date().toLocaleString();
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="Author: "+name;
p.innerHTML="Description: "+finalsummary;
p1.innerHTML="Last update:"+finaldate;
p1.setAttribute("class","ui-li-aside");
a.appendChild(p1);
a.appendChild(p);
a.appendChild(h3);
li.appendChild(a)
document.getElementById("content").appendChild(li);
<ul id="content"></ul>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to disable anchor tag in jquery?

From Dev

H3 and Anchor Tag bottom aligned

From Dev

How to find anchor tag in div and add class?

From Dev

how to trigger an anchor tag resides on the page by clicking on another anchor tag

From Dev

How to add an anchor tag to a URL in a String

From Dev

How to add data to the anchor tag in HTML and access it using jQuery?

From Dev

AngularJS Directive not working to simply add a H3 tag

From Dev

Apply anchor tag to all the h3 tag under a class

From Dev

How to check if a string is an anchor tag?

From Dev

How to prepend the Image or Icon to h3 tag of JQuery Accordian

From Dev

How to create anchor tag

From Dev

How to add class to particular li with anchor tag?

From Dev

PHP-OOP How can I pass an anchor tag inside the <p> tag?

From Dev

How to replicate an anchor tag in Excel

From Dev

how to trigger an anchor tag resides on the page by clicking on another anchor tag

From Dev

How to use an anchor tag with jQuery

From Dev

HTML: how to add anchor tag without effecting visual display?

From Dev

how can I add h3 on actionlink

From Dev

How to add an active class to an anchor tag based on URL and Vanity URLs?

From Dev

How to add "<p>" as a tag value at XSLT

From Dev

How to fetch the data after the h3 tag

From Dev

How to check if a string is an anchor tag?

From Dev

add 1 to number within <h3> tag

From Dev

How to add a class to the image tag within anchor tag on hover?

From Dev

How to pass variable in anchor tag

From Dev

How to add Anchor tag on every database entery using codeigniter

From Dev

How to find a h3 tag with a certain value

From Dev

How to add <pre> tag inside the <p> in html?

From Dev

How to add an anchor tag in the middle of a <p> element when using document.createElement("p")

Related Related

  1. 1

    how to disable anchor tag in jquery?

  2. 2

    H3 and Anchor Tag bottom aligned

  3. 3

    How to find anchor tag in div and add class?

  4. 4

    how to trigger an anchor tag resides on the page by clicking on another anchor tag

  5. 5

    How to add an anchor tag to a URL in a String

  6. 6

    How to add data to the anchor tag in HTML and access it using jQuery?

  7. 7

    AngularJS Directive not working to simply add a H3 tag

  8. 8

    Apply anchor tag to all the h3 tag under a class

  9. 9

    How to check if a string is an anchor tag?

  10. 10

    How to prepend the Image or Icon to h3 tag of JQuery Accordian

  11. 11

    How to create anchor tag

  12. 12

    How to add class to particular li with anchor tag?

  13. 13

    PHP-OOP How can I pass an anchor tag inside the <p> tag?

  14. 14

    How to replicate an anchor tag in Excel

  15. 15

    how to trigger an anchor tag resides on the page by clicking on another anchor tag

  16. 16

    How to use an anchor tag with jQuery

  17. 17

    HTML: how to add anchor tag without effecting visual display?

  18. 18

    how can I add h3 on actionlink

  19. 19

    How to add an active class to an anchor tag based on URL and Vanity URLs?

  20. 20

    How to add "<p>" as a tag value at XSLT

  21. 21

    How to fetch the data after the h3 tag

  22. 22

    How to check if a string is an anchor tag?

  23. 23

    add 1 to number within <h3> tag

  24. 24

    How to add a class to the image tag within anchor tag on hover?

  25. 25

    How to pass variable in anchor tag

  26. 26

    How to add Anchor tag on every database entery using codeigniter

  27. 27

    How to find a h3 tag with a certain value

  28. 28

    How to add <pre> tag inside the <p> in html?

  29. 29

    How to add an anchor tag in the middle of a <p> element when using document.createElement("p")

HotTag

Archive