[text$= ] and different browser problems and links
Hi
I'm trying to append a pdf img to my anchor tags that refer to pdf files. Now in FF it works perfectly but in IE6 & 7 it seems to simply ignore the [text$=] part of the selector.
This is what I have as a simple example:
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript" src="jquery.js" ></script>
<script type="text/javascript">
$(document).ready(function(){
$("a[href$='.pdf'], a[text$='.pdf']").append('This is a pdf file');
});
</script>
</head>
<body>
<a href="this.pdf">this is a pdf file</a>
<br />
<a href="this">this.pdf</a>
</body>
</html>
Now in FF both <a> have the appended html. In IE only the first one has.
I tried the following
-
$("a[href$='.pdf'], a:contains('.pdf').append('PDF FILE')
Of course this works but its not the results I was looking for as the following would look odd by appending a pdf img/text at the end:
-
<a href="#" >A .pdf file is the extenstion used for pdf files.</a>
Any idea how I can search the innerhtml of the <a> for a string of text?
Also why does .click work in FF but not IE?