0

I added click event listener onclick called DagOpenFlyout to a span element:

"<span class=\"btnFlyout\" id=\"btn" + i + "\" style=\"width: " + cellW + "px; cursor: pointer;\"  onclick=\"DagOpenFlyout('cell" + i + "', " + i + ")\">\n"

Here is an implementation of the function:

function DagOpenFlyout(elt, tbItemIndex)
{   
    parent.parent.mapFrame.OpenFlyout(500, tbItemIndex);
}

On the DagOpenFlyout function I need to pass event argument and in DagOpenFlyout function I need to access client.X and client.Y the properties of the event argument.

How do I pass event argument to DagOpenFlyout function?

4
  • 1
    if (window.event) event; // This Commented Dec 3, 2016 at 20:24
  • 1
    Exactly how you pass any other argument: DagOpenFlyout(event, ....). Commented Dec 3, 2016 at 20:26
  • @FelixKling onclick=\"DagOpenFlyout('cell" + i + "', " + i + ", " + event + ")\" I try this. to sent event argument. But it seems to be wrong. Commented Dec 3, 2016 at 20:56
  • 1
    onclick=\"DagOpenFlyout('cell" + i + "', " + i + ", event)\" . event is a variable inside the event handler. Commented Dec 3, 2016 at 20:57

1 Answer 1

1

Close the DagOpenFlyout function over the onClick handler.

function DagOpenFlyout(elt, tbItemIndex) {
    return function(event) {
        // You can access event argument here in the onClick handler.
    };
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.