Revision of Twine: loading jQuery without editing the HTML from Thu, 04/25/2013 - 00:00

You can load jQuery into your Twine game via Google Hosted Libraries using this simple script code:

(function(){
  var s = document.createElement('script');
  s.src = 'http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js';
  document.body.appendChild(s);
  setTimeout(function f(){ 
    if (jQuery) {
      $.noConflict(); 
      jQuery(document).ready(function() {
        //whatever
      });
    } else setTimeout(f,1);
  },1);
}());

Change whatever you want the function passed to ready() to do.

Note: using Google Hosted Libraries of course means that people can't play your game without a live internet connection. Nevertheless, it can be more convenient for you, the author, due to not having to host the jQuery file yourself.