I use head merging and JsCmds.Script, for example:
<head>{ JsCmds.Script(JsCmds.OnLoad(/* initialization code here */)) }
</head> ++
<form ...>...</form>
Lift will automatically move the <head> tag coming out into the HTML
head tag, and JsCmds.OnLoad is equivalent to jQuery ready(), so the
code will only be executed once the DOM is loaded.
Hope that helps,
-Ross
On Sep 29, 2009, at 7:48 AM, philip wrote:
>
>
> Hi, I want to run some javascript to initialize my component which is
> a YUI richtexteditor.
> Can help? This seems to be the wrong way to do it.
>
> Thanks, Philip
>
> class RichEditor
> {
> def show = <form method="post" action="#" id="form1">
> <textarea id="editor" name="editor" rows="20"
> cols="75">
> </textarea>
> { JsCmds.Run("alert('hi')") }
> </form>
> }
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
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/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---