I have a series of divs ( displaying graphics). Click one graphic div and something is written in a div.
$("#graphic1").click(function(){
$("#text").html("Something important goes here.")
}
But if the user clicks graphic1 when graphic8 is displayed I want it to do something else
if (graphic8 was active before graphic1 was clicked){
do this
} else {
do that
}
To explain further
- there are many divs.
- any one of these divs may be active at one time.
- when selecting a new div I would like to know which div was active BEFORE the new div was selected.
EDIT 9/14 in response to answers
Here's a quick example at jsfiddle: http://jsfiddle.net/MAYO/2DEnY/2/
I would like that for the divs to 1. toggle 2. when selecting a new div that the description is displayed below. I tried and failed doing combinations of if/else clauses. 3. After this little bit is done (and I think solving this would solve the next) I would like it that the text description be able to be different depending upon which div was previously active.