# Sortable element with event observe problem

**URL:** <https://www.ruby-forum.com/t/sortable-element-with-event-observe-problem/76753>\
**Category:** Engines\
**Created:** [November 20, 2006, 10:20pm UTC](https://www.ruby-forum.com/t/sortable-element-with-event-observe-problem/76753 "2006-11-20T22:20:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guillefar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/d26b3c/32.png) [@guillefar](https://www.ruby-forum.com/u/guillefar)\
**Post date:** [November 20, 2006, 10:20pm UTC](https://www.ruby-forum.com/t/sortable-element-with-event-observe-problem/76753/1 "2006-11-20T22:20:19Z")

</div>

I have this problem, and i dont know how to fix it:  
In a sortable element made with a foreach loop, im using something like:

Event.observe(Â‘buttonÂ’+i, Â‘clickÂ’, function(e){ alert(i) } );  
where “button+i” are several images of the sortable element  
(button1, button2… ) and “i” is the counter variable of the loop.  
The problem is that I need a element that being click execute a function  
who pass a number(i). Ex:  
[button 1], function: delete(1)  
[button 2], function: delete(2)  
[button 3], function: delete(3)  
[button 4], function: delete(4)… and so  
This works great in Firefox, an even I can get any attribute of  
the dom elements where the function (in the above example, Â“alertÂ”) is.  
But in IE dont work in any way.  
Do you have any suggestions?  
ThanksÂ…  
PD. “Onclick” events dont work, cause the elements are in a  
sortable (or at least, i dont know how to do it)  
PD2, I try to use bind, and bindAsElementListener in several ways, but  
dont seems to work…

* * *

Correo Yahoo!  
Espacio para todos tus mensajes, antivirus y antispam Â¡gratis!  
RegÃ­strate ya - [http://correo.espanol.yahoo.com/](http://correo.espanol.yahoo.com/)

---

<div class="post-metadata">

**Author:** ![guillefar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/d26b3c/32.png) [@guillefar](https://www.ruby-forum.com/u/guillefar)\
**Post date:** [November 21, 2006, 1:02am UTC](https://www.ruby-forum.com/t/sortable-element-with-event-observe-problem/76753/2 "2006-11-21T01:02:53Z")

</div>

You really want to ask on the main rails list (or even the spinoffs  
list) for queries that are about prototype/javascript. This list is  
for support of the engines plugin.
