开发者

Jquery older version works but not newer

This fiddle http://jsfiddle.net/mjmitche/U5BuM/ works in jquery 1.3.2 but not the latest 1.5.1. It was created using an old tutorial. Do you know how to make it work for 1.5.1?

Should I expect a lot of problems like this while learnin开发者_如何学Cg jquery? What's the best way to deal/ learn about these conflicts as I'm trying to learn jquery?


Try putting quotes around the href selector:

$("li a[href$='.pdf']")...

According to the documentation:

attribute An attribute name.

value An attribute value. Quotes are mandatory.


I think you'll find this works

$(function() {
  $("li a[href$='.pdf']")
  .after("<img src='http://quoraquora.com/small_pdf_icon.gif' align='absbottom' />");
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜