[Greasemonkey] custom element properties

Nikolas Coukouma lists at atrus.org
Tue Aug 23 14:18:11 EDT 2005

Timothy Babych wrote:

> Hello everybody.
> I used to use custom properties of elements in my scripts.
> With inroduction of GM 0.5 this trick does not work anymore in Deer Park
> while working well in FF 1.0.x

In this case, you can use setAttribute and getAttribute. Here's the
script that works in 0.5:
// ==UserScript==
// @name           TeST
// @include      *
// ==/UserScript==

function hello() {

a = document.createElement('a')
linktxt = document.createTextNode('A node')
// use setAttribute
a.setAttribute("my_param", 111);

a.addEventListener('click', hello, false)

// use getAttribute

More information about the Greasemonkey mailing list