I'm working on implementing a drop-down menu in my HTML, and my goal is to have a JavaScript function called whenever the user changes the selected value in the menu. Currently, here's what I have:
HTML/PHP:
<select name="selectSquad" class="SquadWeaponSelector" id="selectSquad" onchange="javascript:showWeaponEditorWindow(this.form.selectSquad);">
<?PHP
$max = $squadNumbers - 1;
$i = 0;
while($i <= $max){
echo "<option value=\"".$names_split[$i]."\"/>".$names_split[$i]."</option>";
$i++;
}
?>
</select>
JavaScript – desired behavior:
function showWeaponEditorWindow(squad){
if(squad == "A PHP Value - Jack"){
alert("jack selected");
}
}
Any suggestions on how I can achieve this functionality?