0

I'm calling a javascript for my Gridview, but it seems like document.all does not work in Chrome/Firefox.

What can I replace this with? Thank you

<script type="text/javascript">
    GridViewHelper.Init(document.all.GridView1, 100, 0);
</script>
lepe
  • 24,677
  • 9
  • 99
  • 108
user2217565
  • 1
  • 1
  • 2
  • looks like a dupe http://stackoverflow.com/questions/2408424/document-all-vs-document-getelementbyid or this one http://stackoverflow.com/questions/10350142/why-is-document-all-falsy – David Chase Mar 28 '13 at 16:26
  • 3
    `document.all` hasn't been a good choice since IE 4 stopped being a common install. You need to find some more up to date learning resources. – Quentin Mar 28 '13 at 16:28

1 Answers1

3

document.getElementById is the usual choice (the element needs an id).

There are plenty of other options though, including the new, shiny and less well supported document.querySelector.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335