views:

80

answers:

1

Hey guys, this bit of code works in IE but not in Chrome, any idea why?

    <script type="text/javascript">
    function fillreply(commentID){
        var item = document.getElementById("replyto");
        item.value=commentID;
    }
    </script>
 ...

 ...
   <div id="makereply" class="hidden">Reply to: <input type="text" size="6"  
       name="replyto" readonly />

In IE javascript:fillreply(4); will work but not in chrome where nothing happens.

+2  A: 

Your input doesn't have an id attribute, and you're trying to retrieve it with getElementById.

<input type="text" size="6" id="replyto" name="replyto" readonly="readonly" />
jimyi
doh! thanks (15 chars)
Petey B