Google Groups

Re: [Lift] Ajax adding onclick in HTML


Roch Delsalle Apr 30, 2012 2:45 PM
Posted in group: Lift
Hi Jeppe,

Yes that's exactly what I want to do,
Well, the reason why I want to use event listeners is because I think it's cleaner.
I guess it doesn't make such a big difference but I was wondering why Lift doesn't do it by default.

Thanks for your help,

Roch

2012/4/30 Jeppe Nejsum Madsen <je...@ingolfs.dk>
On Mon, Apr 30, 2012 at 3:47 PM, Roch Delsalle <rdel...@gmail.com> wrote:
> Hi,
>
> I recently started using Ajax with lift. I noticed that lift is adding
> onclick="" attributes into the HTML it produces.
> I would like to know if lift is able to do it using Event Listeners ?

I assume you mean something like

element.addEventListener('click', function() { do ajax stuff }, false);

? If so, then no, not using the standard SHtml methods to generate the
HTML. But you can always construct your own event listeners and have
them perform the requested ajax call.

Out of curiosity, why would you rather use event listeners rather than
inline js?

/Jeppe

--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code