I've got a page (members only, sorry) that lists articles in a database. Beside the list is an icon to show if it is visible or not. I used to have it in a form that when you clicked the image the database would be updated and the appropriate status image would be shown. Somewhere along the line prototype changed and the click event would only work once. I've changed it today so that it uses event.observe and I run through my data array twice. Once to create the layout and once to create the javascript. <td align='center' id='activate_54748'><img id='activate_img_54748' src='/img/accept.png'></td> HTML: and the ajax looks like Event.observe('activate_img_54748', 'click', function(event) { new Ajax.Updater('activate_54748','/contents/activate/54748/0', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'activate_54748']})}, false); Code (markup): When it is clicked firebug shows me the returned code is <img id='activate_img_54748' src='/img/accept.png'> HTML: but I still can't click it a second time. Because the id that the observe is watching still exists I would expect it to be able to observe as many clicks as I send its way. Anyone know why its playing up?
Solved by making the table cell the watched entity. I guess the image being replaced loses the "observe".