开发者

How to extract element using .find of jQuery?

I'm having such stuff

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Sht #3</title>
    <script type="text/javascript" src="jquery-1.5.1.min.js"></script>
  </head>
  <body>

  <div style="-moz-transform-origin: bottom left;">

Begin PDF
<br />
      <embed type="application/pdf" id="pdf" src="plugin-lshort.pdf" style="width:300px;height:400px;" />
<br />
End PDF

</div>

  </body>
</html>

I've used jQuery.find like this

$(document).find("[nodeName!='EMBED']")

OK. It can return 2 elements BR

But when I try to extract the EMBED element by:

$(document).find("[nodeName='EMBED']")

or

$(document).find("[nodeName=='EMBED']")

It was unable to return my expected EMBE开发者_StackOverflowD element.

Anyone kind please help me ? Thanks


You should be able to get the embed element with

$(document).find('embed')

or more concisely, just

$('embed')

This works because you're searching for a tag name. It's no different than searching for $('a') or $('div')


Just do this :

$('embed')

It will return all the embed elements.

You can do a lot of stuff with this : http://blog.insicdesigns.com/2010/05/a-complete-guide-to-jquery-1-4-selector-expressions/ Have a look there for more information

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜