Is it possible to grab a link by its href if it doesn't have a class or ID?

后端 未结 10 874
北恋
北恋 2021-01-07 08:56

I\'m using someone else\'s app and want to change the innerHTML in between any < a>< /a> tag that has a certain href. But these links don\'t have a class or ID associa

10条回答
  •  心在旅途
    2021-01-07 09:07

    You can do this without jQuery.

    var links = document.querySelectorAll('a[href*="example.com"]');
    

提交回复
热议问题