Problem is when I press a key over a radio button, element MyFunc
fires twice - once for onkeypress
event, another time for "click" event.
Question "Why?" I need to handle this by two different ways, but now I can not recognize what initial event was. When I click a mouse it fires just for "click" event.
<ul>
<li>
<input type="radio" onkeypress="MyFunc(event, this)" onclick="MyFunc(event, this)" name="myList" id="MyId_1" />Topic 1
<input type="radio" onkeypress="MyFunc(event, this)" onclick="MyFunc(event, this)" name="myList" id="MyId_2" />Topic 2
</li>
</ul>
function MyFunc(e, obj) {
alert(e.type); // alerts "keypress" and then "click"
// Do my stuff
}