# Sample ImageViewer close ViewerVisible  from JS

**URL:** <https://forums.fusetools.com/t/sample-imageviewer-close-viewervisible-from-js/1506>\
**Category:** How-to Discussions\
**Created:** [September 23, 2016, 7:53pm UTC](https://forums.fusetools.com/t/sample-imageviewer-close-viewervisible-from-js/1506 "2016-09-23T19:53:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KaMeKuN](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@KaMeKuN](https://forums.fusetools.com/u/KaMeKuN)\
**Post date:** [September 23, 2016, 7:53pm UTC](https://forums.fusetools.com/t/sample-imageviewer-close-viewervisible-from-js/1506/1 "2016-09-23T19:53:02Z")

</div>

im following this tutorial: [ImageViewer](https://github.com/fusetools/fuse-samples/tree/master/Samples/ImageViewer), i want to close the image with JS,  
so i have this:

```auto
	<Panel Alignment="TopRight" Padding="10" ux:Name="CloseButton" Margin="5" Clicked="{closePreview}">	
			<Translation Vector="1.5,-1.5,0" RelativeTo="Size" ux:Name="TheTrans"/>
			 <Rectangle Layer="Background" Fill="1,1,1,0.8" CornerRadius="5"/>
			<Image File="../Assets/cancel.png" Color="0,0.1,0.2,1" Clicked="{closePreview}" />	
			<!-- <Clicked>
					<Set ViewerVisible.Value="false"/>
			</Clicked> -->	
		</Panel>

```

Inside my Js i have a method called closePreview with his respective export:

```auto
function closePreview(){
	console.log("Close Preview");
	console.log(ViewerVisible.Value);
	ViewerVisible.Value = "true";
}

```

The log return null on the first time, how do i access to the uxName or tag?

```auto
LOG: Close Preview
LOG: null
LOG: true

```

PD: everything work fine with the tag and clicked tag.

Regards.- 👍

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [September 29, 2016, 11:43am UTC](https://forums.fusetools.com/t/sample-imageviewer-close-viewervisible-from-js/1506/2 "2016-09-29T11:43:17Z")

</div>

Hi,

Sorry for the late reply.

You cannot manipulate arbitrary properties on UX element from JS (due to the async execution nature of Fuse).

That means, this is not possible:

```
    ViewerVisible.Value = "true";

```

Instead, use an `Observable` in JS and data-bind `ViewerVisible Value="{obs}"` to the observable.

Hope that helps. Thanks!
