开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜