Created
October 3, 2018 10:05
-
-
Save BeFiveINFO/258b62f4eadc0e9eee26ed77b881fdfb to your computer and use it in GitHub Desktop.
Scrape page url and title of a tags by using jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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