views:

31

answers:

2

hi guys,

using pure javascript can i select all a tags with href="#xyz". And also i would like to trigger some event while clicking on that element too...

how can i do that?

PS: pure javascript means without using jquery or other frameworks

A: 

document.links[i].href

Kormie
+2  A: 
for (i=0;i<=document.links.length;i++) {
  if (document.links[i].href == '#xyz') {
    // here you will have "selected only the ones with #xyz
    // Just be careful with the test, it will require a http://..../ I believe
  }
}
zeroFiG
thnx it helped.
KoolKabin