Hi,
After I've populated a page with some <INPUT ...> elements I'd like to
have access to whatever is written there.
The best I've done (which does not work) is:
================
// ==UserScript==
// @name AddInput
// @author me
// @description Add an input field and save it with
GM_setValue()
// @namespace http://127.0.0.1/
// @include http://www.wisenut.com/*
// ==/UserScript=
var text_Function = function(evt, elm) {
GM_log(elm.getAttribute('id') + ' ==> ' + elm.getAttribute('value'));
//GM_setValue(elm.getAttribute('id'), elm.getAttribute('value'));
};
var newdiv = document.createElement('div');
newdiv.setAttribute('style', 'background-color:#cccccc;padding:8px');
var lbl = document.createElement('label');
lbl.setAttribute('for', 'inputname');
lbl.innerHTML = 'Name: ';
newdiv.appendChild(lbl);
var elem = document.createElement('input');
elem.setAttribute('id', 'inputname');
elem.setAttribute('type', 'text');
elem.setAttribute('value', 'change me');
elem.addEventListener('blur', function(evt){text_Function(evt,elem);},
true);
newdiv.appendChild(elem);
document.body.appendChild(newdiv);
================
Is there any way to get the name written in the input field instead of
"change me"?
Thank you.