Hi there,
what about adding jquery to a page. Like this:
- Clicking on a bookmark (which loads the same url into a new window)
- Adding Jquery.js
- Run some jquery..
Hi there,
what about adding jquery to a page. Like this:
Take alook at: jQuerify Bookmarklet
It's not only possible to include the jQuery source right from the Firebug console, but you can also add a bookmarklet to your Bookmarks toolbar for one-click jQuery action!
The bookmarklet code:
var s=document.createElement('script');
s.setAttribute('src','http://jquery.com/src/jquery-latest.js');
document.getElementsByTagName('body')[0].appendChild(s);
I am not sure what your question is, but I'm going to try to answer it:
To use jQuery you must include the jQuery.js document in a script tag (I'd recommend the head-section).
You can do this by either downloading the jquery document from jQuerys page (remember to choose the minified version), put it in a folder and insert the correct path to the jquery document where I typed "jquery.js", and do like this:
<script type="text/javascript" src="jquery.js"></script>
Note that script must be closed, don't selfclose
However, you can also use a CDN hosted copy of jQuery. You can choose which CDN you want here. This is an example using jquery's own hosted document:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
Add this code to the new window that you will open, before the $(document).ready()
var fileref=document.createElement('script');
fileref.setAttribute('type','text/javascript');
fileref.setAttribute('src', 'Jquery.js');
if (typeof fileref!=undefined)
document.getElementsByTagName("head")[0].appendChild(fileref);
I need to ask if the site is yours, or you're only testing with the site, if the site isn't yours, you can use firebux and jQuerify, if the site is yours, just add that code between tags.
Create a link and add this to the href: "javascript:var%20s=document.createElement('script');s.setAttribute('src',%20'http://jquery.com/src/jquery-latest.js');document.getElementsByTagName('body')[0].appendChild(s);alert('jQuery Applied');void(s);"
and the drag it to your bookmarks