JavaScript:
function test(){
alert('onchange success');
}
PHP + HTML :
<select id="mySelect" onchange="test();">
<?php
$myRow = 1;
for($i = 0 ; $i < 3 ; $i++){
if($i == $myRow){
echo("<option selected='selected'>$i</option>");
} else {
echo("<option selected=''>$i</option>");
}
}
?>
</select>
My problem and question
Why function test()
doesn't get called when PHP declared option is selected?
Additional Info: No errors in Console.