Forgive me if this is a stupid question but I'm new to javascript and ext. Awesome project btw.

So I'm creating a note viewing tool using perl cgi and have ext tabs with static content. The notes are read from a text file and displayed in a viewing tab. I have a button placed at the bottom of each note that on click I want it to switch tabs to the editing tab(it is also executing a perl sub via ajax). How I am doing this at the moment is as follows.

//the button with $i being the note #, and $timestamp being the timestamp of the note in question
<input id="timestamp_ss$i" type="hidden" value="$timestamp">
<input type="button" id="edit_ss$i" value="edit" onclick="edit_note(['timestamp_ss$i'], ['resultsdiv']);"/>

//this is a loop so that for every note this is added to my script
Ext.get('edit_btn$i').on('click', function(){change('edit_notes');});

function change(tab){
The issue I am running into is that it only works for the first 12 or so notes.

I know there has to be a better way but I'm not familiar enough with javascript to figure it out. Is there a way of accomplishing this without having to create a unique id for each button?

Any help would be appreciated.