I have observed some strange behavior with the following code, can someone explain why this does not work and how to correct it?
This does not work
// Get the value from a hidden field that contains val to set in dropdown
var selectedState = $("#stateSelected").val();
console.log(selectedState); // Returns "OH"
// Now set the value of the drop down.
$("#state").val(selectedState);
This does work
$("#state").val("OH");
What is going on here?
Aucun commentaire:
Enregistrer un commentaire