I want to use javascript to add a link inside a div, this div doesn’t have id , it does has a class though:
<div class="details">
<div class="filename">test.xml</div>
<div class="uploaded">25/12/2012</div>
<a href="#" class="delete">Delete</a>
<div class="compat-meta"></div>
</div>
How to add a link inside the “details” div and above the “delete” link?
The link I want to add is:
<a href="#edit_link" class="edit">Edit</a>
go for jquery, it’s simple and clean.
you can grab any element with a particular class say
like this
now you want to append someother element just before the anchor having
deleteclass, well than you can do this:there are other methods also to append an element inside any other element or dom
for using jquery, you will need its api, directly use this link in your page or, download the latest jQuery api and use it.
its simpler and easier.