why this jquery code doesn't work if i add class to <P>

Posted by metal-gear-solid on Stack Overflow See other posts from Stack Overflow or by metal-gear-solid
Published on 2010-04-24T12:32:44Z Indexed on 2010/04/24 12:43 UTC
Read the original article Hit count: 207

Filed under:
|

It works

var tip = "<p>Most computers will open PDF documents automatically, but you may need to download <a title='Link to Adobe website-opens in a new window'";
tip +=" href='http://www.adobe.com/products/acrobat/readstep2.html' target='_blank'>Adobe Reader</a>.</p>";


if($("div#maincontent a[href*='.pdf']").length>0){
    $("div#maincontent").children(":last-child").after(tip);

but it not

var tip = "<p class="adobe-reader-download">Most computers will open PDF documents automatically, but you may need to download <a title='Link to Adobe website-opens in a new window'";
tip +=" href='http://www.adobe.com/products/acrobat/readstep2.html' target='_blank'>Adobe Reader</a>.</p>";


if($("div#maincontent a[href*='.pdf']").length>0){
    $("div#maincontent").children(":last-child").after(tip);

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about XHTML