Add 1px to padding of element with jquery
How do I add 1px to the pad开发者_如何学JAVAding of a div element with jquery? The div element might have any amount of padding beforehand, and I want to increment the padding by 1px.
Get the old value, add one pixel to it, and assign it as the new value:
obj.css("padding", parseInt(obj.css("padding"))+1)
If your former padding value is not in pixels you will probably do some conversion first.
精彩评论