Load onchange does not work
Hello there,
I am pretty new to Jquery and I am stuck with a task I would like to do. My goal is to trigger a function onselect of a select box. Somehow I can't get the code written that way. Currently it works onload. I would like to make it load via load_area2();
Here it my code:
-
//function load_area2(){
$(function () {
var cat = $(\'#categorySelect\');
var el = $(\'#elementSelect\');
var attr = $(\'#attributeSelect\');
el.selectChain({
target: attr,
url: \'/x_dev/select/select-chain-data.php\',
data: { ajax: true, anotherval: "anotherAction" }
});
//alert(\'test\');
// note that we\'re assigning in reverse order
// to allow the chaining change trigger to work
cat.selectChain({
target: el,
url: \'/x_dev/select/select-chain-data.php\',
data: { ajax: true }
}).trigger(\'change\');
});
//}
//-->
</script>
Region:
<select id="categorySelect" name="province_select" style="width:116px;font-size:11px;border:0;" onchange="load_area2()";>
Thank you for any hint!