-1

I want to use jQuery in my Bookmarklet. I included the source to my bookmarklet.js into the bookmarklet, so there is no more place for the jQuery File.

I've tried this to include jQuery inside the included bookmarklet.js

var s=document.createElement('script');
s.setAttribute('src','http://jquery.com/src/jquery-latest.js');
document.getElementsByTagName('body')[0].appendChild(s);

But it doesn't work. What did I do wrong?

iWeb
  • 233
  • 1
  • 3
  • 8

1 Answers1

0

try adding one more attribute to specify the type of the source file:

s.setAttribute('type', 'text/javascript');
Benny Tjia
  • 4,853
  • 10
  • 39
  • 48
  • Nope, that doesn't work. I guess it's not working because it's a bookmarklet. When I add jQuery with the jQueryify Bookmarklet ist works fine, so the rest of my code is working. – iWeb Apr 28 '11 at 20:06