So I had this button element that would refuse to fire its onclick() function whatever I did and it drove me crazy for a while :
<button type="button" id="newTreatment" name="newTreatment" onclick="newTreatment()" >Add a treatment</button>
I ended up simply changing the name of the function and it worked immediatly :
<button type="button" id="newTreatment" name="newTreatment" onclick="addTreatment()" >Add a treatment</button>
I've since then tested it on several other buttons and I've had similar issues all the time.
So is this really what's happening? The onclick() function can't have the same name as the id if its element? Why is that? I've tried looking for this online but I couldn't find any information about it.