# Access to a function Parameters

**URL:** <https://forums.fusetools.com/t/access-to-a-function-parameters/6612>\
**Category:** How-to Discussions\
**Created:** [October 20, 2015, 1:52am UTC](https://forums.fusetools.com/t/access-to-a-function-parameters/6612 "2015-10-20T01:52:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cristian\_Karmy](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/cristian_karmy/32/480_2.png) [@Cristian\_Karmy](https://forums.fusetools.com/u/Cristian_Karmy)\
**Post date:** [October 20, 2015, 1:52am UTC](https://forums.fusetools.com/t/access-to-a-function-parameters/6612/1 "2015-10-20T01:52:23Z")

</div>

I have a Each element like this:

```auto
<Each Items="{MyItem}">
    <Panel>
        <Text Value="{Text}"/>
        <Clicked Handler="{WhatId}" />
    </Panel>
</Each>

```

And in Js I have:

```auto
function MyItem(Text,Id){
    this.Text = Text;
    this.Id = Id;
}

function WhatId(){
}

```

How can Access in Js to the Id of the clicked Each (MyItem)?

Thanks!

---

<div class="post-metadata">

**Author:** ![COCPORN](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/cocporn/32/576_2.png) [@COCPORN](https://forums.fusetools.com/u/COCPORN)\
**Post date:** [October 20, 2015, 7:26am UTC](https://forums.fusetools.com/t/access-to-a-function-parameters/6612/2 "2015-10-20T07:26:59Z")

</div>

Hi! Hopefully this example makes it clear how to access the context of the clicked item:

```auto
<App Theme="Basic">
    <StackPanel>
        <JavaScript>
            var Observable = require('FuseJS/Observable');
            var selectedItemName = Observable('None selected')
            function selectItem(args) {
                console.log (JSON.stringify(args));
                selectedItemName.value = args.data.name
            }
            module.exports = {
                items : [
                    {name: "item1"},
                    {name: "item2"},
                    {name: "item3"}
                ],
                selectedItemName: selectedItemName,
                selectItem: selectItem,
            }
        </JavaScript>
        <Text Value="{selectedItemName}" />
        <Each Items="{items}">
            <Panel Clicked="{selectItem}">
                <Text Value="{name}" />
            </Panel>
        </Each>        
    </StackPanel>
</App>

```

The `console.log`-statement will list the available properties on the clicked arguments:

```auto
{"data":{"name":"item1"},"x":53,"y":36,"index":0}
{"data":{"name":"item2"},"x":25,"y":48,"index":0}
{"data":{"name":"item3"},"x":27,"y":68,"index":0}

```

---

<div class="post-metadata">

**Author:** ![Cristian\_Karmy](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/cristian_karmy/32/480_2.png) [@Cristian\_Karmy](https://forums.fusetools.com/u/Cristian_Karmy)\
**Post date:** [October 20, 2015, 6:51pm UTC](https://forums.fusetools.com/t/access-to-a-function-parameters/6612/3 "2015-10-20T18:51:02Z")

</div>

Thanks!
