0

<a class="button" 
   onclick="location.href = 'https://www.getthishref.com';" 
</a>

Anyone have an idea on what the selector might look like for this? I'm looking to extract the https://www.getthishref.com.

1 Answers1

0

You have to first get 'onclick' value, then use regular expressions:

const onclick_val = $('a.button').attr('onclick');
const regex = /'(.*?)'/g;
const found = onclick_val.match(regex);
Milad Abooali
  • 686
  • 1
  • 13
  • 30