Thanks for the added reply Justin, although I am just confused now. I think I need some newbie hand holding.
Maybe I should explain the ultimate goal. The function getContentAlt set up to be reusable. I pass variables col2 and col3 depending on which link is clicked. I would set up multiple Event.observe's for this.That function needs to know what 'this' is because the first if statement tests to see if the class name is 'current' or not. if it is, it does not follow through with the function and does not follow the link. Right now the function does not know what 'this' is I presume, because I get this error.... $(this).hasClassName is not a function getContentAlt("/includes/content/contact-col-2.php", "/includes/ content/contact-col-3.php")functions.js (line 369) (no name)() wrapper(click clientX=0, clientY=0) if ($(this).hasClassName('current')) { On Apr 17, 9:28 pm, anathema <[EMAIL PROTECTED]> wrote: > Maybe I am confused as to where to put Event.stop(event) because the > link still gets followed. > > On Apr 17, 9:09 pm, kangax <[EMAIL PROTECTED]> wrote: > > > > Event.observe(window, 'load', function() { > > > It might be better to listen to 'dom:loaded' event on a document > > (since it fires as soon as DOM is ready) > > > > Event.observe('emailus', 'click', getContentAlt(col2, > > > col3)); > > > Event.observe needs a function reference as a third argument. You > > probably meant to do: > > > Event.observe('emailus', 'click', function(){ getContentAlt(col2, > > col3) }); > > // or > > $('emailus').observe('click', function() { getContentAlt(col2, > > col3) }); > > > > function getContentAlt(col2, col3) { > > > > if ($(this).hasClassName('current')) { > > > > return false; > > > > } > > > return false; wouldn't work in Event.observe. You need to use > > Event.stop(event). > > > Best, > > kangax --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---