I know this has an accepted answer, but in reading the replies on the answer, I see some things that I can clear up that might help other people having issues with events not triggering after a value change.
This will select the value in the drop-down:
$("#gate").val("gateway_2")
If this select element is using JQueryUI or other JQuery wrapper, use the refresh method of the wrapper to update the UI to show that the value has been selected. The below example is for JQueryUI, but you will have to look at the documentation for the wrapper you are using to determine the correct method for the refresh:
$("#gate").selectmenu("refresh");
If there is an event that needs to be triggered such as a change event, you will have to trigger that manually as changing the value does not fire the event. The event you need to fire depends on how the event was created:
If the event was created with JQuery i.e. $("#gate").on("change",function(){}) then trigger the event using the below method:
$("#gate").change();
If the event was created using a standard JavaScript event i.e. then trigger the event using the below method:
var JSElem = $("#gate")[0];
if ("createEvent" in document) {
var evt = document.createEvent("HTMLEvents");
evt.initEvent("change", false, true);
JSElem.dispatchEvent(evt);
} else {
JSElem.fireEvent("onchange");
}