grazie della risposta
effettivamente uso un trucco del genere simile alla prima soluzione (creo un nuovo attributo al elemento).