Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery increase height by 10px without selecting element twice

Tags:

jquery

I want to increase my selected elements height by 10px. Is there a better way without selecting the element twice.

E.g

$(this).height($(this).height()+10);

Is there some method in jquery which handles this that I have missed?

like image 634
John Magnolia Avatar asked Dec 08 '12 14:12

John Magnolia


People also ask

How can increase Div height in jQuery?

Answer: Use the JavaScript height() method You can set the height of a <div> box dynamically using the jQuery height() method.

Which jQuery method is used to show selected elements by adjusting height?

jQuery height() Method The height() method sets or returns the height of the selected elements. When this method is used to return height, it returns the height of the FIRST matched element. When this method is used to set height, it sets the height of ALL matched elements.

How does jQuery calculate window height?

Basically, $(window). height() give you the maximum height inside of the browser window (viewport), and $(document). height() gives you the height of the document inside of the browser.

What is jQuery height?

In jQuery, height method is used to get the height of any element in HTML. The height method sets and returns the height of the HTML elements. Method 1: The height() method returns the first matched element's height, But the height(value) method sets all matched elements height.


1 Answers

Try something like this:

$(this).height("+=10");
like image 84
Tim Joyce Avatar answered Oct 03 '22 23:10

Tim Joyce