gpt4 book ai didi

jquery - 如何给变量添加样式?

转载 作者:太空宇宙 更新时间:2023-11-04 10:37:34 24 4
gpt4 key购买 nike

如何为文本添加样式:第一季/第二季/第三季”...?这是我目前使用的代码:

$(document).ready(function()
{
var data = [
{text: 'Season One', url: "/Season?open=1"},
{text: 'Season Two', url: "/Season?open=2"},
{text: 'Season Three', url: "/Season?open=3"},
{text: 'Season Four', url: "/Season?open=4"},
{text: 'Season Five', url: "/Season?open=5"}
];
$('#SeasonInput').autocomplete(data,
{
formatItem: function(item)
{
return item.text;
}
}).result(function(event, item)
{
location.href = item.url;
});
});

我尝试了 .css({'margin: 0', 'background-color: white'}) 和其他变体,但没有成功。

最佳答案

你的 .css 是错误的。必须是这个对象:.css({margin: '0', 'background-color': 'white'})
({key: value, key: value}, ' around key如果不包含-可以省略)。

关于jquery - 如何给变量添加样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36053055/

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