使用jquery来确定选择的选项会导致“指定的属性被弃用".警告 [英] Using jquery to determine selected option causes "specified attribute is deprecated" warning

查看:83
本文介绍了使用jquery来确定选择的选项会导致“指定的属性被弃用".警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能遗漏了一些显而易见的东西,但我不知道发生了什么.我正在尝试使用jquery来确定下拉列表中的当前选定选项(请参见小提琴),但是当我进行以下操作,我会在(FF9)控制台中收到警告.

Probably missing something pretty obvious but I can't figure out what is going on. I am trying to use jquery to determine the currently selected option in a dropdown (See fiddle) but when I do something like the following I get a Warning in the (FF9) console.

var selectedValue=$('#testSelect option:selected').val();

警告消息:

警告:不赞成使用属性的指定属性.它总是返回true.

Warning: Use of attributes' specified attribute is deprecated. It always returns true.

我做错什么了吗?这是我应该关注的事情吗?预先感谢.

Am I doing something wrong? Is this something I should be concerned with? Thanks in advance.

推荐答案

jquery引用了Attr对象上的"specified"属性,Firefox 7弃用了该属性,并且始终返回true.参见 https://developer.mozilla.org/En/DOM/Attr

jquery is referencing the "specified" property on an Attr object, this is depreciated with Firefox 7, and always returns true. see https://developer.mozilla.org/En/DOM/Attr

我为此提出了一张jquery票证: http://bugs.jquery.com/ticket/11397

i've raised a jquery ticket for this: http://bugs.jquery.com/ticket/11397

这篇关于使用jquery来确定选择的选项会导致“指定的属性被弃用".警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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