Executing a jquery function to all href attributes
<pre><code>function openFile(file) {
    var extension = file.substr( (file.lastIndexOf('.') +1) );
    switch(extension) {
        case 'jpg':
        case 'png':
        case 'gif':
            alert('was jpg png gif');  
        break;                         
        case 'zip':
        case 'rar':
            alert('was zip rar');
        break;
        case 'pdf':
            alert('was pdf');
        break;
        default:
            alert('who knows');
    }
};

openFile("somestring.png");
</code></pre>

<p>I got this piece a code from another question posted here, but im unsure how to implement it for my purpose. I want to check the hrefs of every link and place the appropriate icon for the file type. </p>
