November 2, 201115 yr Hi all, i am just learning more about jquery, i have on a website a shipping calculator that works from a link, it pops up and you select the country and press a submit button to calculate shipping for your country, i have changed this to be inline with the rest of the basket details, so onchange it calculates the shipping, the problem i have with this is it will not calculate shipping onload. so using jquery i have triggered an onchange event which works but then puts the page in a loop so another country can not be selected. <script> $(document).ready(function() { $('#myselect').trigger('change'); }) </script> <select id="myselect" name="country_id" onchange="this.form.submit();"> is there away around this or am going about it the wrong way Thank you
November 3, 201115 yr Hi all, i am just learning more about jquery, i have on a website a shipping calculator that works from a link, it pops up and you select the country and press a submit button to calculate shipping for your country, i have changed this to be inline with the rest of the basket details, so onchange it calculates the shipping, the problem i have with this is it will not calculate shipping onload. so using jquery i have triggered an onchange event which works but then puts the page in a loop so another country can not be selected. <script> $(document).ready(function() { $('#myselect').trigger('change'); }) </script> <select id="myselect" name="country_id" onchange="this.form.submit();"> is there away around this or am going about it the wrong way Thank you I hope I'm not misunderstanding your question. You want to calculate shipping onload, right? Did you try this bit of code? $(function(){ $(window).bind("load", function(){ //calculations }) }) Edited November 3, 201115 yr by Iris
November 3, 201115 yr Author I hope I'm not misunderstanding your question. You want to calculate shipping onload, right? Did you try this bit of code? $(function(){ $(window).bind("load", function(){ //calculations }) }) thanks for the reply, i did it a different way in the end, the shipping form method was get so onload i set the country_id to 77 in the URL Thank you
Create an account or sign in to comment