I have an ASP.NET reportviewer in a page whose width (a div width) I am trying to determine.
I have the test code below. The first alert returns the proper client id. I can see the div in the html source. I can see its width in FireBug. However the second alert returns null. The syntax looks fine. Why is it returning null?
<script type="text/javascript" src="includes/jquery-1.4.2.min.js"></script>
<script type="text/javascript" language="javascript">
alert('<%=rvMain.ClientID %>');
alert( $('#<%=rvMain.ClientID %>').width() );
</script>
Have your elements loaded at the time that javascript fires? Try using a document.ready
call and see if you get the same result.