-1

Before I start, I'd like to point out I'm completely new to programming, so I hope my question isn't one that doesn't make sense at all and makes you guys rage. If it is, I'm very sorry, please enlighten me about it.

¨

I'm trying to make a script (in tampermonkey) that will look for a specific text/link on a webpage, and if that text is on the page, it will click on it.

For instance: Let's imagine we refresh the page and sometimes a link called "Bob" appears. I do not know the target of "Bob", so just asking the script to redirect me to the target link isn't an option. I need something that actually clicks on "Bob". U get me? The problem here is I only know the name of the link, and nothing more. So I'd need a script which, first of all, looks for something called Bob, and secondly, clicks on it.

Thanks for helping,

--Bram

¨

PS: I'm completely new to programming, so if you decide to help me out (which I'd greatly appreciate <3) please explain it like I'm a total idiot/newbie. Thanks!

bram
  • 99
  • 2
  • 11
  • Duplicate of OP's previous question: [Click on specific links on a webpage with javascript?](http://stackoverflow.com/questions/21738632/click-on-specific-links-on-a-webpage-with-javascript) – Brock Adams Feb 13 '14 at 23:38

1 Answers1

0

Just samples are below. Syntax can be wrong but they will give you an idea I think.

//Get all anchors

var anchors = $("a:contains('Bob')")

//Click it

$(anchors[0]).click();

And you can searc on stackoverflow look this links will help you;

How to select all anchor tags with specific text
How can I simulate an anchor click via jquery?

Community
  • 1
  • 1
Mehmet
  • 1,824
  • 3
  • 19
  • 28