Using the onChange event with slider

I am trying to use the slider linked to a select box. The two controls synchronise well but the original onChange functionality of the select box has been lost. Is there a way to link a slider to a select box without losing the pre-existing onChange functionality or by inserting an additional function to the one used to synchronise the slider?

linkTo method sets onchange event handler for the select. For this reason, the previous event handler is redefined. To solve the issue you may set onchange listener for the select:

var mySel = document.getElementById("select1"); if (mySel.addEventListener) mySel.addEventListener("change", hisFunction, false); else if (mySel.attachEvent) mySel.attachEvent("onchange", hisFunction); function hisFunction(){ /*some code here*/ }

Hi Darya,
Thanks for the code.
At first I used this to supplement the onchange code on the select box. All the slider functionality worked with the slider being updated when the select box was changed and vice versa. However, the extra function included in the onchange event of the select box was only executed when the value of the select box was changed directly by clicking on it and not when the value was changed programatically by the clicking or draging slider. I then tried adding the extra function to the onchange event of the slider and then it worked fine whichever control was used to change the value. Slightly surprising but I got what I wanted in the end.
Thanks again.

You are welcome!