# Matching button instance to XML node value

**URL:** <https://forum.kirupa.com/t/matching-button-instance-to-xml-node-value/260219>\
**Category:** Uncategorized\
**Created:** [May 13, 2008, 3:48pm UTC](https://forum.kirupa.com/t/matching-button-instance-to-xml-node-value/260219 "2008-05-13T15:48:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LauraMS](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@LauraMS](https://forum.kirupa.com/u/LauraMS)\
**Post date:** [May 13, 2008, 3:48pm UTC](https://forum.kirupa.com/t/matching-button-instance-to-xml-node-value/260219/1 "2008-05-13T15:48:16Z")

</div>

I want Montana data to appear when I click the state of Montana (and so on throughout the 50 states). Montana is the instance name of my simple button on the state of Montana.

Something’s not quite right about this line of code:

if (pEvent.target == myXML.statename\*) { …then do something …}

\*The code works fine if I say  
if (pEvent.target == Montana)

Do I have to convert the myXML node value to text or something?

---

<div class="post-metadata">

**Author:** ![LauraMS](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@LauraMS](https://forum.kirupa.com/u/LauraMS)\
**Post date:** [May 13, 2008, 6:01pm UTC](https://forum.kirupa.com/t/matching-button-instance-to-xml-node-value/260219/2 "2008-05-13T18:01:02Z")

</div>

if (pEvent.target.name == myXML.statename\*)

[quote=LauraMS;2325614]I want Montana data to appear when I click the state of Montana (and so on throughout the 50 states). Montana is the instance name of my simple button on the state of Montana.

Something’s not quite right about this line of code:

if (pEvent.target == myXML.statename\*) { …then do something …}

\*The code works fine if I say  
if (pEvent.target == Montana)

Do I have to convert the myXML node value to text or something?[/quote]
