On Fri, Nov 18, 2016 at 12:06 PM, David Farmer <
far...@aimath.org> wrote:
>
> I am trying to monitor the usage of the sage cells on a web page, so I
> inserted code like this:
>
> $("button.sagecell_evalButton").on('click', function() {
>
> do_stuff_here
>
> }
>
> Everything seems to be working fine, except that the first time I click an
> evaluate button,
> nothing seems to happen. The second and later clicks work as usual.
>
> My javascript records the initial click, even though the cell is not being
> evaluated.
>
> If I replace do_stuff_here by *absolutely nothing*, the first click on the
> evaluate button
> still has nothing happen. So I am guessing that I should use some other
> method to
> record the clicks on the evaluate buttons.
It's conceivable you might be hitting this, though I doubt it...
http://stackoverflow.com/questions/11184276/return-false-from-jquery-click-event
>
> In case it matters, the above jascript is inside a setTimeout, so that it
> doesn't run until
> after the sage cell code builds the cells on the page. Probably that is not
> the right way
> to do it, either.
That sounds sketchy. Is there an event that the sage cell library
fires when it's done initializing or some callback function you can
register?
(I've never even looked at the source code of sage-cell's javascript library...)
>
> Also, there are a dozen or so (linked) cells on the page, and it does not
> matter which
> button I click first: nothing happens to any of them. But they do flash a
> color, so I know
> I am clicking it.
>
> Any suggestions?
>
> David
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cell" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
sage-cell+...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/sage-cell/51505dd0-6ab3-475d-ba7e-4ff8510b2968%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
William (
http://wstein.org)