This is probably very simple and stupid, but I'm trying to use jQuery to open all pdf files in new windows. I used the code below and got this error:
uncaught exception: syntax error, unrecognized expression: [href $ =. pdf]
I am sure any help would be appreciated.
Note. I came under jQuery for $ because I use Wordpress.
<script type="text/javascript">
jQuery(function() {
jQuery("a[href$=.pdf]").click(function() {
window.open(this.href);
});
});
</script>
source
share