Hello, I'm writing this bookmarklet in Javascript, which is also calling some JQuery objects. The goal here is to pull the page title, URL and any currently selected text, then fill them into fields on the target page.
The problem is that it only works when I'm on the page with the fields I'm trying to fill in! I've tried everything but I'm at a loss. Can anyone help me out? Here's the code:
javascript: (function() {
title = document.title;
url = document.URL;
text = document.getSelection();
w = window.open('My site');
w.onload = function run() {
w.$('#id_title').val(title);
w.$('#id_url').val(url);
w.$('#id_description').val(text);
}
})();
Any help is greatly appreciated, as I'm a a js novice.