A site I'm working on was built using jQuery v1.8.3. I'm attempting to upgrade to v1.9.0. Using the jQuery Migration plug-in (v.1.0.0), I'm getting messages in the console saying .attr() is deprecated.
In the .js file these two lines are being used:
var branchID = $('select#ddlBranches').attr('value');
$('select#ddlBranches').attr('value', branchID).change();
They're intended to get the value (which is a record ID) of the current selection in the dropdown, and fire the change event on the dropdown, setting it to the indicated value.
The first line results in this message in the console: "property-based jQuery.fn.attr('value') is deprecated"
The second line causes this to show in the console: "property-based jQuery.fn.attr('value', val) is deprecated"
The Upgrade guide discusses .attr(), but I don't see anywhere that mentions what to replace it with.
What am I supposed to replace .attr() with to accomplish the same functionality?
Thanks for anyone's help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…