jQuery - if clause to run function if link has a specific ID
<p>I need to run a script if a link clicked is <code>artist_link</code>. The reason I need to do this is because I have a history api script and the script needs to run if this link is clicked. It runs on page load but since the history api ajaxes in the content there is no page loads. </p>

<p>Here's what I have;</p>

<pre><code>if ($('a').attr('id') == 'artist_link'){ alert ('hello'); }
</code></pre>

<p>Okay I should have explained this. It must be an if clause since the script will only be ran <strong>IF</strong> the link clicked has that specific ID. The clause is within an AJAX request which is part of my hisory api script.</p>

<pre><code>$.ajax({
    url: url,
    type: 'GET',
    dataType: "html",
    success: function (responseData) {

        $("#main").hide().html($("#load", responseData)).fadeIn(500); //fadeIn new page
        if (url =='Home'){
         $.ajax({
         type: "GET",
         url: "AJAX/request_feed.js",
         dataType: "script"
         });
        }
        if (url =='Discover'){

         $.ajax({
         type: "GET",
         url: "AJAX/get_artists.js",
         dataType: "script"
         });

         }

         if ($('a').attr('id') === 'artist_link'){ alert ('hello'); }






    },
    error: function (jqXHR, textStatus, errorThrown) {
        window.location.replace("404");
    }
});
</code></pre>

<p><strong>UPDATE: </strong></p>

<p>Also, the click funtion is right at the start of the history script so I just need to determine if the <code>a</code> clicked has that specific ID</p>

<pre><code>$(document).on("click", "a", function (event) {
</code></pre>
