jQuery对象禁用事件侦听器,如何检测html属性何时更改 [英] jQuery object disabled event listener, how to detect when a html attribute changes

查看:18
本文介绍了jQuery对象禁用事件侦听器,如何检测html属性何时更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为 select 标签创建一个事件监听器.它应该在元素变为 disabledenabled 时触发.

I need to make an event listener for a select tag. It should be triggered any time the element becomes disabled or enabled.

这可能吗?

P.S.:onchange 不会检测到禁用.

P.S.: onchange does not detect disabling.

推荐答案

可以使用这个jquery .watch 插件.

It is possible using this jquery .watch plugin.

http://darcyclarke.me/development/detect-attribute-changes-with-jquery/

插件检测 css 更改,但我在 this JSfiddle 中对其进行了编辑以适用于属性.

The plugin detects for css changes, but i edited it in this JSfiddle to work for attributes.

看看这个 JSfiddle.

这篇关于jQuery对象禁用事件侦听器,如何检测html属性何时更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆