I have this weird bug occuring when a function name is the same as an input name :
<script>
function sameName() {
console.log("Clicked sameName")
}
function sameName2() {
console.log("Clicked sameName2")
}
</script>
<form>
<input type="text" id="sameName" />
<input type="button" value="bug" onclick="sameName()" />
</form>
<input type="text" id="sameName2" />
<input type="button" value="no bug" onclick="sameName2()" />
In order to reproduce the bug :
- the function and the input text must have the same name
- the input text and button have to be in the same form
Is there a mistake in my code or is it a bug?
Thanks
edit : thanks to VLAZ, I saw that it's not a jquery related bug, But I still don't understand why there is an error only when it involves two inputs in a form. There's no error if the input text is switched for a div for example.