I have a bunch of elements on a page that are formatted like below:

```
<div class="longdesc">
 <pre style="...">
   //stuff here
 </pre>
</div>
<div class="longdesc">
 <pre style="...">
   //stuff here
 </pre>
</div>

```

I'm trying to replace some of the content inside the `<pre>` tag but I'm having trouble. 

```
(function () {    
    var nodes = document.getElementsByClassName("longdesc");
    for (var n=0; n<nodes.length; n++) {
        var node = nodes[n].getElementsByName("pre");
        node[0].textContent = node[0].textContent.replace("<", "&lt;");
        //other code
    }
})();

```

> 
> VM5185:4 Uncaught TypeError: nodes[n].getElementsByName is not a
>  function
> 
> 
> 

I only need the first `pre` in each `longdesc`. How can I do this?