0

I have been working on this project and I'm stuck. If the user doesn't select one of the Buttons There is a message:"U heeft nog geen categorie geselecteerd", but then if te user tries again with the same picture it doesn't check again because it doesn't trigger the .addEventlistener, is there another way of doing the .addEventListener or to clear the file everytime the user didn't clicked on one of the buttons?

Thanks

fileButton.addEventListener('change', function(e) {
if(hannibalus == "Hannibalus"){
minions.innerHTML = "U heeft nog geen categorie geselecteerd"
}else{
ChadT
  • 7,598
  • 2
  • 40
  • 57
Dirk Vis
  • 9
  • 3
  • 1
    It sounds like you might be looking for `.on('change', function(e) {`. Then it will trigger every time. – Obsidian Age Feb 14 '17 at 23:10
  • sparse info here... if you want the event to occur when the user **clicks** on a button, then why not add your function to the `click` event instead of the `change` event? – The Conspiracy Feb 14 '17 at 23:24
  • please `include a screen-shot` of whatever you are trying to accomplish - is not clear enough from here - how your user interface looks like, and it's hard to give appropriate advice. Maybe adding a listener to `onblur` event - will help - you remove the selected image only when no category is chosen - but i can't say for sure. – AIon Feb 14 '17 at 23:33
  • Possible duplicate of [HTML input file selection event not firing upon selecting the same file](http://stackoverflow.com/questions/12030686/html-input-file-selection-event-not-firing-upon-selecting-the-same-file) – Kaiido Feb 15 '17 at 03:21

0 Answers0