I'm not sure if this is the issue, Adam, but have you tried using a string
for the height value instead of an integer...and in doing so, also
specifying an explicit unit of measure (such as pixels)? Generally, CSS
rules won't honor values that don't have units (unless the value is zero in
which case units are obviously irrelevant). 

Also, as Sam said, to make sure the DOM element (in your case: <div
id="myDiv"><!-- contents here --></div>) you are trying to affect has been
loaded into memory by the browser, you need to wrap your statements inside
one of the several varieties of jQuery "load-check wrappers". Code within
these jQuery wrappers won't execute until the DOM is ready (one of the best
features of jQuery!). Extending Sam's example, try specifying a "600px"
height like so:

<script type="text/javascript">
<!--
  $(function() {
     $("#myDiv").height("600px");
  });
-->
</script>

<div id="myDiv" style="border:1px solid #f00;"></div>



-THEO-



-----Original Message-----
From: Sam Collett [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 15, 2007 1:15 PM
To: jQuery Discussion.
Subject: Re: [jQuery] .height(val) - what am I missing?

On 15/01/07, John Resig <[EMAIL PROTECTED]> wrote:
> Hmm... I can't verify this. I popped open a test page and set the
> .height() and it worked just fine. Perhaps a more complete example is
> in order?
>
> --John
>
> On 1/15/07, agent2026 <[EMAIL PROTECTED]> wrote:
> >
> > All I"m trying to do is set the height of a div (jQuery 1.1), but no go.
> > What am I missing?
> >
> > <script type="text/javascript">
> > <!--
> >  $("#myDiv").height(600);
> > -->
> > </script>
> >
> > <div id="myDiv" style="border:1px solid #f00"></div>
> >
> > Preparing to feel dumb,
> > Adam
> > --

Looks like you are trying to set it before the DOM has loaded. Try:

<script type="text/javascript">
<!--
  $(function() {
     $("#myDiv").height(600);
  });
-->
</script>

<div id="myDiv" style="border:1px solid #f00"></div>




_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to