Why does height( value ) does not work?
Hi, I'm brand spanking new to jquery. After having used yui 3.0 for awhile, I was fed up of their auto-sandbox model. It just made it too difficult to create a multi-tier architecture for a large web application.
I like the fact that jquery doesn't make this impossible by adding it's own sandbox. This is actually a good feature! Please don't change it!
Anyway, I am having trouble getting some basic stuff working, so please don't tell me this is a bad sign! The one thing YUI 3.0 has going for it is that it really just does work like you would expect.
I made a function extension called maxHeight(), which computes the maximum height from all the elements in the query. Pretty straight-forward ;)
- $.fn.maxHeight = function() {
- var maxHeight = 0;
- this.each( function() {
- maxHeight = Math.max( $(this).height(), maxHeight );
- });
- return maxHeight;
- };
- var maxHeight = $("#PlayArea ul").maxHeight();
Now I want to set the height to all the elements, like this:
- $("PlayArea ul").height( maxHeight + "px" );
Unfortunately, this doesn't work. The value for maxHeight is correct, so I have to assume that the height() function is not working? I also tried css( "height", maxHeight + "px" ), and that also doesn't work. I am using the latest version of firefox and ie. Same problem on both.
Thanks much for the help.