Skip to content

Instantly share code, notes, and snippets.

@BeFiveINFO
Created October 3, 2018 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BeFiveINFO/258b62f4eadc0e9eee26ed77b881fdfb to your computer and use it in GitHub Desktop.
Save BeFiveINFO/258b62f4eadc0e9eee26ed77b881fdfb to your computer and use it in GitHub Desktop.
Scrape page url and title of a tags by using jQuery
var a = jQuery('.main-menu-item.menu-item-even.menu-item-depth-0.contains-mega-sub-menu.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-has-children .mega-sub-menu.row a.menu-link');
var aa = [];
a.each(function(i,e){
var b = $(e).text();
var c = $(e).attr('href');
aa.push({title:b,url:c});
});
JSON.stringify(aa);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment