>
> My problem is that after the confirm() UI appears and is clicked, it
> appears AGAIN, then when I click again does the expected behaviour occur.
>
> document.observe("dom:loaded", function() {
> // attach to all delete links in the table
> var dels = $$('td a.delete');
> dels.each(function(s){
> s.observe('click', function(event){ confirmDelete(event); } );
> } )
> });
>
>
> function confirmDelete(event)
> {
> var ask = confirm('Are you sure you want to delete this entry?');
>
> if(ask){ xfoo = 'follow link - delete it'; }
> else{ event.stop(); xfoo =' do nothing - stop event '; }
> }
>
>
Try to show target of click events in your confirmDelete(), e.g. like this:
function confirmDelete(event) {
var ask = confirm('Are you sure you want to delete this entry?' +
'\n(clicked on ' + Object.inspect(event.findElement()) + ')');
if(ask){ xfoo = 'follow link - delete it'; }
else{ event.stop(); xfoo =' do nothing - stop event '; }
}
It will give additional information, e.g. that your code receives click
events from both A and IMG elements.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/prototype-scriptaculous/-/roQUKu3aa8cJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.