I am trying to set a default option in a select menu from the local storage, I am using a GUID as the value.
<script type="text/javascript">
    $(document).ready(function () {
        var guid = getParameterByName("dashId");
        //$("#cboDashboards").val(guid); - Attempt #1 
        //$("#cboDashboards > option[value=" + guid + "]").prop("selected", true); - Attempt #2
        //jQuery('#cboDashboards > option[value="' + guid + '"]').prop('selected', true) - Attempt #3
    });
    document.getElementById("cboDashboards").onchange = function () {
        localStorage.dashboardGuid = this.value;
        window.location.href = "/Home/Index?dashId=" + this.value;
    };
</script>
The GUID that gets stored is the same as the GUID that I try to populate the combo box with, however, I have tried three different methods of trying to populate the combo box and none have worked. Any suggestions to why this isn't working as expected?
EDIT - Would this method have any effect on it? It's called to populate the combo box with the values:
function populateDashboard(data) {
    var options = $("#cboDashboards");
    $.each(data, function () {
        options.append($("<option />").val(this.DashboardGuid).text(this.Name));
    });
}
I populated some test data -
<select  id="cboDashboards">
    <option value="0">Select dashboard</option>
    <option value="1">Select dashboard 1</option>
    <option value="2">Select dashboard 2</option>
    <option value="3">Select dashboard 3</option>
    @* <option value="0">Select dashboard</option>*@
</select>
and I did :
$("#cboDashboards").val('1'); // - Attempt #1
This worked, so I seem to be having a problem with the GUID value?
