jquery - Website Image logo Url -
i want logo image url website "http://www.ford.com/",i using jquery selector that,but project based on node js. think logo has background-image in css write code not run..
var $ = cheerio.load(html); $(".globalnav-header #badge a.logo .img").filter(function() { console.log( $(this).css('background-image')); });
don't use .filter
. try:
var $ = cheerio.load(html); console.log( $(".globalnav-header #badge a.logo .img").css('background-image'));
i tested code on ford's website this:
ford doesn't use jquery, needed include before running code:
var jq = document.createelement('script'); jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; document.getelementsbytagname('head')[0].appendchild(jq);
then ran code , worked.
> console.log( $(".globalnav-header #badge a.logo .img").css('background-image')); url(http://www.ford.com/resources/ford/global/images/logo/fordoval_header_168x31.png)
Comments
Post a Comment