I have a button which 'adds to favourites'. I have an eventListener which then adds the details to a database and i want change the title to 'remove from favourites' and background image of the button when click. instant feedback.
However, if they click again it would remove it from the database.
What is the most efficient way to do this? query the favorites database on each click? and show either button base in the query results?
v tired today and not getting anywhere fast.
thanks in advance