Thank you justsomeguy that makes a lot more sense of what is going on. I had a little look at .bind() and read, as iwato says, that it is now deprecated, so started looking at .on() but to no avail. I am just a newbie so please be patient with my lack of coding skills.
dsonesuk here is my code (I think I have managed to anonymise it)