在jQuery中禁用活动按钮(Disable active button in jQuery)

编程入门 行业动态 更新时间:2024-10-28 16:25:32
在jQuery中禁用活动按钮(Disable active button in jQuery)

我有一个导航栏,我已经能够像我喜欢这个jQuery代码一样修复它的行为:

$(document).bind('mobileinit', function () { $.mobile.activeBtnClass = 'unused'; });

但这样我禁用了我的webapp中的所有按钮......

我想把它瞄准一组特定的按钮。

我怎样才能做到这一点?

我会做:

$(document).bind('mobileinit', function () { $(".myclass").activeBtnClass = 'unused'; });

要么

$(document).bind('mobileinit', function () { $(".myclass").mobile.activeBtnClass = 'unused'; });

但这不会奏效......

哪里不对?

I have a navigation bar and I've been able to fix its behaviour as I like with this jQuery code:

$(document).bind('mobileinit', function () { $.mobile.activeBtnClass = 'unused'; });

But this way I disable ALL the buttons in my webapp...

I'd like to aim it to a specific set of buttons.

How can I achieve that?

I'd do:

$(document).bind('mobileinit', function () { $(".myclass").activeBtnClass = 'unused'; });

or

$(document).bind('mobileinit', function () { $(".myclass").mobile.activeBtnClass = 'unused'; });

But this won't work...

What is wrong?

最满意答案

你的建议很有意思,roXon,但因为我想让用户在使用我的webapp时了解他的位置。

幸运的是jQuery人员考虑过这种问题,我已经能够非常轻松地解决这个问题,添加了class =“ui-btn-active ui-state-persist”所以我的按钮。

不管怎么说,还是要谢谢你!

Your suggestion was interesting, roXon, but since I wanted to let the user understand where he was while using my webapp.

Fortunately jQuery guys thought about this kind of issue and I have been able to solve the problem very easily adding class="ui-btn-active ui-state-persist" so my button.

Thanks anyway!

更多推荐

本文发布于:2023-07-26 18:25:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1279309.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮   jQuery   Disable   button   active

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!