views:

125

answers:

2

Hi all!

This is embarrassing, but here goes. Here's the page that I'm working on: www.mchenry.edu/administration/BoardSchedule.asp

I'm using jQuery ver. 1.3.1 and I'm putting tiger stripes on the table. All is well. However, I want to insert a FileInfo class after all .pdf file extensions in the document, so users know they are selecting a PDF. Here's my little fileinfo.js jQuery snippet:

$(function(){
    $('<span class="FileInfo"> PDF </span>').insertAfter('li a[href$=.pdf]');
});

Why isn't it working? Is it something silly? This snippet works on other pages, just not here. What's going on?

Thnx.

+1  A: 

I think that what you want to do is...

$(function(){
    $('table a[href$=.pdf]').after('<span class="FileInfo">PDF</span>');
});

Btw, why not to use just CSS instead?

table .pdf:after, table [href$=.pdf]:after {
    content: " PDF";
}
coma
what's the difference in this and "insertafter"? don't they both do the same except the selector and the contents locations are switched
TStamper
yup..."This operation is, essentially, the reverse of doing a regular $(A).after(B), in that instead of inserting B after A, you're inserting A after B."http://api.jquery.com/
coma
+1  A: 

You are searching for all the a elements under a LI element, if you want to use it on the links of your table, you should change your selector:

$('td a[href$=.pdf]').after('<span class="FileInfo"> PDF </span>');
CMS
I feel like such a dolt. Thnx.
Jesse