Why doesn't .change() handler work while change selection in my dropdown programmatically?

Why doesn't .change() handler work while change selection in my dropdown programmatically?

Here's my code:
  1. var $packageDialog = $("#package-dialog"); var $packageSelector = $("#package", $packageDialog); $packageSelector.change(function () { .... });

It works fine when I do selection on UI. Now I'm trying to do pre-selection via code:




  1. $('option:eq(1)',$packageSelector).attr('selected', true);

It never fires. I wonder why and how to have it fixed.