Hi
i am new to java scripting
i have a shopping list with items with a edit link
<td class="a"></b><a href="#contactForm">edit</a></td>
how would id do it so i can get the id of the item, normally i could do this
<td class="a"></b><a href="edit.php?id=$id">edit</a></td>
how do i get the id using #contactForm
any idea’s
Sorry, I don’t quite understand your question.
Which id do you mean?
#contactForm
is a fragment identifier.
You can select the link whose href this is like so (using jQuery):
$('a[href="#contactForm"]')
or (vanilla JavaScript):
var links = document.getElementsByTagName("a");
for(var i=0, len = links.length; i < len; i++){
hash = links[i].href.split('#')[1]
if(hash === "contactForm"){
//do something with links[i]
}
}