2

Just because name and onchange function are the same in the select is doesn't work. So, it's normal that the first select doesn't work ? (https://jsfiddle.net/ay1fvruz/)

function selectTypeParty(value) {
 alert(value);
}
function test(value) {
 alert(value);
}
don't work <br>
<form id="mainForm">
    <select name="selectTypeParty" onchange="selectTypeParty(this.value)">
        <option value="melee">Melee</option>
        <option value="classic">Classic</option>
    </select>
</form><br>
work <br>
<form id="mainForm2">
    <select name="selectTypeParty" onchange="test(this.value)">
        <option value="melee">Melee</option>
        <option value="classic">Classic</option>
    </select>
</form><br>
work <br>
<form id="mainForm3">
    <select name="test" onchange="selectTypeParty(this.value)">
        <option value="melee">Melee</option>
        <option value="classic">Classic</option>
    </select>
</form>

Thank you.

Ender-events
  • 89
  • 1
  • 4

1 Answers1

0

You can go around the simple html limitation by using a jquery, example:

$(function () {
    $('select').on('change', function(){
        alert(this.value);
    });
});
Dmitry Sadakov
  • 2,128
  • 3
  • 19
  • 34
  • thanks, but he is good, mainForm2 and mainForm3 work, it,s just i don't understand or that it's normal that the mainForm1 don't work. – Ender-events Aug 08 '15 at 17:42