Mendel Yaffe Mendel Yaffe - 2 years ago 65
Javascript Question

How can I get this code to change the background color every other click?

The div tag referred to is the only code that I added to the HTML text. If possible please provide your answer in just jquery.
$("div").click(funcOne(), funcTwo());

$.funcOne = function(x) {document.getElementsByTagName("div").style.backgroundColor = "blue";};

$.funcTwo = function(x) { document.getElementsByTagName("div").style.backgroundColor = "red";};

Answer Source
$('div').click(function(){ = === 'blue' ? 'red' : 'blue' 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download