How to set a dynamically created select's selected value to a variable's value

How to set a dynamically created select's selected value to a variable's value

Hello,
I have a cookie that contains a select's last selected value. The cookie is well written and assigned to a variable 'myCookie'.

I'm populating a select's options using a php script with $.getJSON

Once the select is populated, how to set its value to myCookie's value?
I thought it was:
  1.  $('#mySelectID').val(myCookie);
But the select does not seem to be updated (or does not show the updated value).

Thanks for your help.