JQuery.height () property not working

I am trying to get the height of an element using jQuery, but getting unexpected results. Here is the code:

$(function() { 
    var contentheight = $('#subpage-content-small').height;
    alert(contentheight);
});

Where # subpage-content-small has these CSS properties:

#subpage-content-small { width: 400px; float: left; margin: 30px 10px 0 0; padding-bottom: 45px; }

What I get as output for my warning is this:

function (f) { var e = this[0]; if (!e) { return f == null ? null : this; } if (c.isFunction(f)) { return this.each(function (j) {var i = c(this);i[d](f.call(this, j, i[d]()));}); } return "scrollTo" in e && e.document ? e.document.compatMode === "CSS1Compat" &&  e.document.documentElement["client" + b] || e.document.body["client" + b] : e.nodeType === 9 ? Math.max(e.documentElement["client" + b], e.body["scroll" + b], e.documentElement["scroll" + b], e.body["offset" + b], e.documentElement["offset" + b]) : f === w ? c.css(e, d) : this.css(d, typeof f === "string" ? f : f + "px"); }

Any idea why I get this and not an integer height? Thanks in advance!

+3
source share
2 answers
var contentheight = $('#subpage-content-small').height();

This is a function, not a property.

+8
source

From jquery:

.css('height') .hight() , ( , 400), ( , 400 ). .hight() , .

height() height

+4

Source: https://habr.com/ru/post/1741990/


All Articles