Hi, I was wondering if anyone could help me with this.
I have a set of 20 images on my html page, each one is the name of a C0cktail shot. Each one has an onclick, which calls the following function, which adds the name of that shot to a <p id> so for example if I click once on a vodka bottle it will then add the text ‘1 Vodka’ to the <p id> if I click on the same image twice it will just add the same text again. Would it be possible to click on an image more than once then have the text ‘1 Vodka’ to change to 2 Vodka)?
My JS Code
function addIngredient(ingredient)
{
if(document.getElementById (‘cTailShaker’).innerHTML.length==0){
document.getElementById (‘cTailShaker’).innerHTML=ingredient;
}else{
document.getElementById (‘cTailShaker’).innerHTML=(document.getElementById (‘cTailShaker’).innerHTML)+”<br />1 ” +ingredient;
}
}