Select jQuery CHANGE element and event in IE8?

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

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

I used the jQuery CHANGE event handler to run the calculation function every time there is a change in my selection elements, for example:

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

And here is my HTML code that comes 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, a change in the selection does not invoke a calculation function.

I investigated this problem and got the opposite data - some say that changing the jQuery event does not work in IE8, and some say that it is.

Then I thought of using the onChange function for JS, but also read that IE8 is not supported.

Could you help me figure out how to do this in all browsers.

+4
source share
3 answers

In my experience, the "change" event in jQuery works in IE8 for select lists, maybe there is another error in the code causing the problem?

0
source

try it

 $("#pages").on("keyup change", function () { // let 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 are using an older version of jquery, you may need to use "bind" instead of "on"

 $("#pages").bind("keyup change", function () { // let 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 }); 
0
source

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

-2
source

Source: https://habr.com/ru/post/1341356/


All Articles