jQuery - checking the result of a function against another
<p>My aim is to check a list of links and get the last section of the the URL in the href for each one. Then, I check the URL of the page.</p>

<p>I have a list of pages inside a folder called Projects. Essentially if the URL is projects/somepage and is equal to projects/somepage in the links href, I want to perform an action.</p>

<p>I can loop through the list and return all of the hrefs in the list, and also get the current page URL, yet I can't figure out how to use each of these results to check  if they are the same.</p>

<pre><code>projectURL = $("#projects ul li a");

$(function() {

    function checkProjectURL() {     
        $(url).each(function(){ 
            var href = $(this).attr("href");
            var current = href.substr(href.lastIndexOf('/') + 1)
            //console.log(current);
        }); 
    }

    function checkPageURL() {     
        var url = document.location.href; 
        var currentURL = url.substr(url.lastIndexOf('/') + 1)
        //console.log(currentURL);

    }

    url = projectURL;

    checkProjectURL();
    checkPageURL();     


}); 
</code></pre>

<p>Any help would be great thanks!</p>
