-1

I have a div in my html page with a id:

<div id="home"> 

I need to put some html like a link so I use jquery and my code is:

$('#home').add('<a href=..../a>);

The problem is that if I go control the DOM with google chrome I can see the element in the div but I can't see the link the page.Anyone can help me?

Picco
  • 423
  • 2
  • 6
  • 21
  • 2
    http://api.jquery.com/html or http://api.jquery.com/append. jQuery has just about the best documentation around. It's worth just skim reading it for an hour to see what methods are available so you can understand what it can and cannot do. – Rory McCrossan Feb 11 '16 at 15:32
  • Two possible solutions available in your question itself. "How `append` `html` in a
    "
    – Rajaprabhu Aravindasamy Feb 11 '16 at 15:34
  • just read the jquery docs or use some Google magic – randomizer Feb 11 '16 at 15:35
  • Possible duplicate of [.append(), prepend(), .after() and .before()](http://stackoverflow.com/questions/14846506/append-prepend-after-and-before) – Phiter Feb 11 '16 at 15:44

1 Answers1

3

Use append() to append content to the div.

 $('#home').append('<a href=..../a>');
Jobelle
  • 2,717
  • 1
  • 15
  • 26