4

I have a small script on my site that calculates a price quote based on the options chosen in 4 different Select elements. The price quote is written into a div and is updated each time there is any change in the selected options.

Here is the link to this page: http://www.justaddsolutions.com/justaddwebsite/prices/

I used jQuery CHANGE event handler to trigger the calculating function each time there is a change in my Select elements, like this:

jQuery("#pages").change(price_quoter);

And here is my HTML code that goes with it:

<select id="pages" class="instant_quote" name="pages"> 
<option value="1">1 page</option>
<option value="2">2 pages</option>

This works fine in Safari and Chrome, but doesn't work in IE8. In IE8 the change in Select elements doesn't trigger the calculating function.

I researched this issue and got contrary data - some say that Change jQuery event doesn't work in IE8 and some say it does.

I then thought to use the onChange function of JS, but also read that it is not supported by IE8.

Could you help with figuring out the way to do it that works in all browsers.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
hanazair
  • 819
  • 1
  • 10
  • 22
  • Just wanted to thank everyone for the responses. I eventually discontinued that site, so never had to go back to fix the issue and test suggested solutions. – hanazair Feb 12 '14 at 19:33

3 Answers3

0

try this

$("#pages").on("keyup change", function () {
    // let's make sure the event is not the problem , could be a problem with price_quoter? 
    alert("yay!! pages was changed");
    // call your function
    price_quoter();
    // do stuff here
});

if you're using an old version of jquery, you might need to use "bind" instead of "on"

$("#pages").bind("keyup change", function () {
    // let's make sure the event is not the problem , could be a problem with price_quoter? 
    alert("yay!! pages was changed");
    // call your function
    price_quoter();
    // do stuff here
});
robert
  • 1,523
  • 5
  • 19
  • 27
0

In my experience the 'change' event in jQuery does work in IE8 for select lists, perhaps there is another bug in your code that is causing the issue?

jrz
  • 4,286
  • 1
  • 29
  • 21
-2

Try using the $("select option").click() event handler instead.

Rui Jiang
  • 1,662
  • 1
  • 15
  • 25
  • Thanks, but click() doesn't establish whether or not there was a change in selected option. I only need to update the price value if there as a change. – hanazair Feb 25 '11 at 20:59