http://docs.jquery.com/CSS/width
$("ul.AspNet-Menu").width($("body").width()); On Nov 8, 7:18 pm, john6630 <john6...@hotmail.com> wrote: > I want to read the body width when a page loads and set an element's > width to the same width. The reason I want to do this is that the page > is generated programmatically. Alternatively I can have the program > set the width value to a constant but in any case, I believe I need to > do this when the page is loaded versus a CSS file that is not created > by the form generator. > > Here is what I have tried: > > <style type="text/css"> > body > { > margin: 0 auto; > width: 430px; > } > </style> > > <script type="text/javascript" src="~/JavaScript/ > jquery-1.3.2.min.js"></script> > <script type="text/javascript"> > $(document).ready(function(){ > $("ul.AspNet-Menu").width() = $("body").width(); > }); > </script> > > Note: my program that creates the page sets the body width. So I could > replace the code with > $("ul.AspNet-Menu").width() = "430px"; > > TIA, > John