wordpress - jQuery(document).ready shouldn't run when I submit the form -
i wrote jquery runs when page loads, , it's good. problem runs when submit form, , messes submission.
is there way around that?
my form: http://goinspire.com/jwrp-hotel-registration/
and jquery file: http://goinspire.com/wp-content/themes/goinspire/js/customjqueryfunctions.js
thanks!
here part of code believe pertinent:
// custom javascript functions jquery(document).ready(function () { tripfilter = function () { var tripclass = '.hotel-trip select', hotelclass = '.hotel-name select', unusedclass = '.unused-options select'; var tripselect = jquery(tripclass), trip = tripselect.val(), hotelselect = tripselect.parents('form').find(hotelclass); if (trip !== undefined && trip !== "") { if (trip === "none"){ jquery(hotelclass+" > option").each(function() { jquery(this).clone().appendto(unusedclass); jquery(this).remove(); }); } else { tripnum = trip.match(/jwrp (\d*)/)[1]; jquery(unusedclass+" > option").each(function() { jquery(this).clone().appendto(hotelclass); jquery(this).remove(); }); jquery(hotelclass+" > option").each(function() { hotelmatch = jquery(this).val().match(/(\d*) /); if(jquery(this).val() != "other|"){ if (hotelmatch === null || hotelmatch[1] != tripnum){ jquery(this).clone().appendto(unusedclass); jquery(this).remove(); }; }else{ jquery(this).appendto(hotelclass); }; }); jquery(hotelclass + 'option[value="other|"]').insertafter(hotelclass + 'option:last-child'); jquery(hotelclass).val(jquery(hotelclass + "option:first").val()); } } } jquery('.hotel-trip select').change(function(){ tripfilter(); }); tripfilter(); });
Comments
Post a Comment