<div dir="ltr">Thanks Johan, that's the kind of advice I need, as there are many ways to do things.<br><br>Now, I am stumped (for hours!) on another very similar problem, except instead of a single variable, I simply want to pass an argument of type "jQuery" into jQuery's replaceWith() function, called within a onClick handler method. So, in my renderContentOn:, I wrote:<br><br> | ajaxRequest |<br> ajaxRequest := (html jQuery post<br> url: html actionUrl;<br> dataType: 'html') html: [ : replaceHtml | self invoke. replaceHtml render: resultWidget ].<br> ....<br> html script defer with:<br> ((html jQuery id: buttonId) onClick:<br> ((html jQuery id: replacementId) replaceWith: ajaxRequest asJavascript) asFunction).<div><br></div><div>However, as before, the argument to replaceWith() is being rendered as a Javascript string literal instead of the code itself. (See red quotes, below, I want it to stop rendering those quotes!).</div><div><br></div><div> $("#id3").click(function(){$("#id4").replaceWith(<b><font color="#cc0000">"</font></b>$.post(&quot;/puf&quot;,[&quot;_s=C8vA8l5UNoUsGTpf&quot;,&quot;_k=B_Wk6EYdovACqAgV&quot;,&quot;2&quot;].join(&quot;&amp;&quot;),&quot;html&quot;)<font color="#990000"><b>"</b></font>)})<br></div><div><br></div><div>I tried many different variations, no success. This must be something simple...</div><div><br></div><div>Thank you.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 9, 2015 at 2:25 AM, Johan Brichau <span dir="ltr"><<a href="mailto:johan@inceptive.be" target="_blank">johan@inceptive.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chris,<br>
<br>
I notice you figured out the use of #alias:<br>
<br>
Use the JS generation facilities only when you need to *generate* code. For example, to embed a server-side callback or, in general, when the code can only be dynamically constructed.<br>
In your case, I would do the following:<br>
<br>
(JSStream on: ‘console.log(event)’)<br>
<br>
Just because you can write it in Smalltalk does not mean you should :)<br>
<span class="HOEnZb"><font color="#888888"><br>
Johan<br>
</font></span><br>
ps: your contributions are in my inbox, I will process them asap<br>
<div class="HOEnZb"><div class="h5"><br>
> On 09 Oct 2015, at 03:46, Chris Muller <<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>> wrote:<br>
><br>
> Found something. JSAlias.<br>
><br>
>> html span<br>
>> class: 'PufMessageWidget' ;<br>
>> id: (self assureHtmlIdUsing: html) ;<br>
>> onClick: ((html javascript logger call: 'log' with: 'event')<br>
>> asFunction: #('event')).<br>
><br>
> I gave up on onClick: since I guess its better to set up event<br>
> bindings through jQuery's API. This binding does what I want, no<br>
> syntax error.<br>
><br>
> html script defer with:<br>
> ((html jQuery id: (self assureHtmlIdUsing: html)) onClick:<br>
> ((html javascript logger call: 'log' with: (html<br>
> javascript alias: 'event')) asFunction: #('event'))).<br>
><br>
> It seems like a pretty wordy way to write console.log(event), but the<br>
> intent reads clearly so, that's good..<br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> seaside mailing list<br>
> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></div></blockquote></div><br></div>