Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using jquery to determine selected option causes "specified attribute is deprecated" warning

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(); 

Warning Message:

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.

like image 803
malonso Avatar asked Dec 05 '11 18:12

malonso


2 Answers

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

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

like image 69
glob Avatar answered Sep 30 '22 02:09

glob


$(document).on('change','select#FIELD_NAME', function() {     alert('your selection was: '+$('select#FIELD_NAME').attr('value'));     return false; }); 

K.I.S.S. ...whenever it's possible ;-)

like image 27
geekbuntu Avatar answered Sep 30 '22 01:09

geekbuntu