Here is a javascript will be ran after the change of edit-panes-delivery-delivery-country option list, several options will be append to the $("select[id^='edit-panes-delivery-delivery-zone']"), but a ajax will also be ran when the change of edit-panes-delivery-delivery-country option list, so the ajax action will cover the result of the javascript.
(function ($) {
// Original JavaScript code.
$('#edit-panes-delivery-delivery-country').ready (function() {
$("#edit-panes-delivery-delivery-country").change(function() {
if ($("#edit-panes-delivery-delivery-country option[value='156']").attr('selected')) {
var myOptions = {
949 : '福州 (hkpost only)',
951 : '廣州 (hkpost only)',
952 : '昆明 (hkpost only)',
956 : '溫州 (hkpost only)',
957 : '廈門 (hkpost only)'
};
$.each(myOptions, function(val, text) {
//alert("added");
$("select[id^='edit-panes-delivery-delivery-zone']").append( new Option(text,val) );
})
}
})
})
})(jQuery);
So, my question is, is it possible to delay the jquery to run for example a few seconds?
ps. The script is run in drupal 7 module, because i don't know alter ajax action in drupal 7, so i choose to delay the jquery to run