# XML/JS -\> error: getAttribute is not a function?

**URL:** <https://forum.kirupa.com/t/xml-js-error-getattribute-is-not-a-function/222996>\
**Category:** web dev\
**Created:** [April 18, 2007, 5:04pm UTC](https://forum.kirupa.com/t/xml-js-error-getattribute-is-not-a-function/222996 "2007-04-18T17:04:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ratherblue](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ratherblue/32/2052_2.png) [@ratherblue](https://forum.kirupa.com/u/ratherblue)\
**Post date:** [April 18, 2007, 5:04pm UTC](https://forum.kirupa.com/t/xml-js-error-getattribute-is-not-a-function/222996/1 "2007-04-18T17:04:21Z")

</div>

Here is my XML:

```auto
<form name="testForm">
    <field>
        <display>Item 1</display>
        <value>Item 1 Value</value>
    </field>
    <field>
        <display>Item 2</display>
        <value>Item 2 Value</value>
    </field>
</form>

```

I want to access the value “testForm”, and I _should_ be able to do this using getAttribute.

My javascript:

```auto
var xmlResponse = ajaxVar.responseXML;
var theForm = xmlResponse.getElementsByTagName("form");
alert(theForm.getAttribute("name"));

```

However both IE and FF complain that “getAttribute” is not a function.

I was reading something about “phantom nodes” earlier. Do I have to reformat my XML?
