Jump to content

Changing href tags


Fabis94

Recommended Posts

Ok so i'm trying to write a Greasemonkey script to change all the hrefs on a single page.

 

The href by default looks like this:

 

<a href="javascript:get('246154895')" class="postid">ID</a>

 

What i'm trying to do is make the number from get() appear in stead of "ID".

How should i get this done?

 

I started up with this:

 

var posts = document.getElementsByClassname('postid');

for (i=0; i<posts.length; i++) {
//Replacing
}

 

But i doubt it will work, since there are other items with the class "postid" that aren't related to these tags i'm trying to change.

 

P.S. I'm new to JS so yeah :P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.