Asp.net, listbox, htc, behavior, autosearch listbox, wcf, certificate document.getElementbyId returns null - Discoveries / Experiences in .Net Application development - Site Home - MSDN Blogs

Discoveries / Experiences in .Net Application development

Discoveries during Web Application development using Asp.Net, C# etc

document.getElementbyId returns null

document.getElementbyId returns null

Rate This
  • Comments 3

I had a strange issue today.

document.getElementbyId returns null, but the object was present in the view source .

then I figured out that the javascript was executed on page load ,before the object was rendered.

Solution:

I set the defer property for the script tag, it worked

<script type="text/javascript" language="javascript" defer >

 

  • Thanks for sharing

    It helped me a lot

  • Thank you!!!!!

  • I did a search on the defer tag earlier, and the page said the defer tag was supported by IE only.  Might want to follow-up on that.  Careful!

Page 1 of 1 (3 items)
Leave a Comment
  • Please add 8 and 4 and type the answer here:
  • Post