For example I want to add 20px to <div id='example'></div>, which is currently 20px.
I could get the existing height and add 20px and input it as the new height, but I wish to learn if there is a better way that might work like a += operator.
You can pass a function into
height()that has the element’s current height as an argument and thereturnof the function will be the new height:Here is a demo: http://jsfiddle.net/grajh/
Docs: http://api.jquery.com/height/