jQuery Error: Object has no method 'height', this.height() -


i have id #list , on click of button want increase size of list elements 50px.

why following code doesn't work:

function test(){    $("#list li").each(function(){        var h = this.height() + 50;        this.height(h);    }); } 

this function activated on button click , on click following error:

uncaught typeerror: object #<htmllielement> has no method 'height' index.html:32 (anonymous function) index.html:32 b.extend.each jquery-1.9.1.min.js:152 b.fn.b.each jquery-1.9.1.min.js:45 test index.html:31 onclick index.html:44 

this dom element. want jquery object.

try $(this).height() :

function test(){     $("#list li").each(function(){         var h = $(this).height() + 50;         $(this).height(h);     }); } 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -