jQuery 尝试内联显示元素会出现错误

发布于 2024-12-28 23:19:06 字数 407 浏览 1 评论 0原文

我正在尝试显示一个 html 元素,但它必须具有 inline 属性。我的代码中的第二行破坏了 html 页面:

$('#add_existing_suggestion').fadeIn(100).show();                                
$('#add_existing_suggestion').css("display":"inline");

我在这个论坛上看到它对人们有用: http ://forum.jquery.com/topic/fadein-inline

有什么方法可以使元素内联显示吗?

谢谢!!

I am trying to display an html element, but it has to have the inline attribute. The second line in my code breaks the html page:

$('#add_existing_suggestion').fadeIn(100).show();                                
$('#add_existing_suggestion').css("display":"inline");

I saw on this forum that it worked for people: http://forum.jquery.com/topic/fadein-inline

Any way I can make the element get displayed inline?

Thanks!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不及他 2025-01-04 23:19:06

css 方法采用两个参数作为字符串或包含样式键/值对的映射。你所做的将会在页面上给出语法错误,并且也会破坏其他js。试试这个

$('#add_existing_suggestion').css("display", "inline");

css method take two arguments as string or a map containing key/value pair of styles. What you are doing will give a syntax error on the page and will break other js also. Try this

$('#add_existing_suggestion').css("display", "inline");
迷离° 2025-01-04 23:19:06

你的语法不正确。 .css() 的语法是:

.css( propertyName )
.css( propertyName, value )

将其更改为 $('#add_existing_suggestion').css("display", "inline");

Your syntax is incorrect. The syntax for .css() is:

.css( propertyName )
.css( propertyName, value )

Change it to $('#add_existing_suggestion').css("display", "inline");

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文