I have the following line in my code:
$('#infs').removeAttr('required');
And when I use the jQuery Migrate plugin, I get the following warning in the debug:
JQMIGRATE: jQuery.fn.removeAttr no longer sets boolean properties: required
I have the following line in my code:
$('#infs').removeAttr('required');
And when I use the jQuery Migrate plugin, I get the following warning in the debug:
JQMIGRATE: jQuery.fn.removeAttr no longer sets boolean properties: required
According to warnings page plugin jQuery Migrate 3.0 +
JQMIGRATE:
jQuery.fn.removeAttr
does not define any more Boolean propertiesCause: Before jQuery 3.0, the use of
.removeAttr()
in an attribute boolean, such aschecked
,selected
orreadonly
would also define the property as false. This behavior was required for older versions of Internet Explorer, but it is not correct for modern browsers because the attribute represents the value and the property represents the current (dynamic) value.Solution: It is almost always wrong to use
.removeAttr("checked")
in one element of the DOM. The only time that might be useful is if the DOM is then serialized back to an HTML string. In all the other cases, should be used.prop("checked", false)
.
Therefore, the code below should resolve:
$('#infs').prop('required', false);