gpt4 book ai didi

javascript - 使用 jQuery 的简单字符串和变量问题

转载 作者:行者123 更新时间:2023-11-28 12:11:04 25 4
gpt4 key购买 nike

我正在尝试将我的 var 添加到此字符串:

var liPad = 20;

$(this).css({'width' : width , 'height' : height, 'padding' : "'0px' + liPad + 'px'"});

要使其像这样工作:

$(this).css({'width' : width , 'height' : height, 'padding' : '0 20px'});

不知道如何让它发挥作用。

如有任何帮助,我们将不胜感激。

最佳答案

这应该有效:

$(this).css({
'width': width,
'height': height,
'padding': '0 ' + liPad + 'px'
});

关于javascript - 使用 jQuery 的简单字符串和变量问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1578131/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com