I am new to jquery and have started using it only a week ago.
I'm slowly getting the hand of different options and what not.
I did have a question for an example.
I have a table that is 3 by 3. Each table I have a blank image. I wanted to make it, so when you click the cell area the image changes to the next and then to the third and then back to the blank.
eg. blankimage, image 1, image 2.
So, I am using the click function to activate it and the attribute option to change the image.
My question is, how would I detected what image is there? By default the html page has the blankimages. When you click the cell blankimage, then image1 loads if you click it again image 2 loads...
I'm just not entirely clear on how the click function works? Do I need to create a click for each click, or can I fit it into one click code?
Question
Valachi
I am new to jquery and have started using it only a week ago.
I'm slowly getting the hand of different options and what not.
I did have a question for an example.
I have a table that is 3 by 3. Each table I have a blank image. I wanted to make it, so when you click the cell area the image changes to the next and then to the third and then back to the blank.
eg. blankimage, image 1, image 2.
So, I am using the click function to activate it and the attribute option to change the image.
$("img").click(function(){ $(this).attr("src","image1.gif"); }); $(this).attr("src","image2.gif");My question is, how would I detected what image is there? By default the html page has the blankimages. When you click the cell blankimage, then image1 loads if you click it again image 2 loads...
I'm just not entirely clear on how the click function works? Do I need to create a click for each click, or can I fit it into one click code?
EDIT: here is an example of it I have so far: http://www.v3n.net/example/tictactoe.html
Link to comment
Share on other sites
2 answers to this question
Recommended Posts