Unable to select <script> tags #14

matthewmueller opened this Issue Jul 17, 2011 · 3 comments


None yet

4 participants



Let me first just say, this is a very cool project. It's been very helpful for me so far.

One thing I haven't been able to do is select script tags. I've written something like

$(htmlcontent).find("script").attr("src")     // undefined

This will always return undefined. The code does work for link elements though. I'm not sure if this is a node-query issue, a jsdom issue, or a jquery issue, but either way I'd really appreciate anyone's insight on this problem!


It's somewhere between jsdom and jquery. Not all of the jQuery unit tests pass on Node.JS with jsdom.

All node-jquery is is just a little wrapper and a package.json. I'd suggest bringing it up with both jsdom and jQuery if you need a solution.


Thanks man,

Actually if I remember right, if you pass something like $("script", HTMLString).attr('src') you're going to get undefined, however if you pass in $("script", document).attr('src') you'll get the source, where document is a jsdom document, or the result of require("jsdom").jsdom(HTMLString)

@treasonx treasonx closed this May 3, 2012

im trying to do this in plain jquery and its failing!
var scripts = $(data).find('script[src]');

did you find anything out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment