Im new to jQuery and have been researching and playing with it as much as possible my issue is im running out of time i need to get this project done asap. Anyways my question…
I have a link when clicked it calls a jquery ajax function which is al working properly… upon success i want the code to change the background colour of a div but this depends on its current colour cause it can be switched back and forth between two colours…
anyways heres what ive been playing with…
highlightColor = "#d8fe00"; //Updated to not cause confusion...
whiteColor = "#ffffff"; //Updated to not cause confusion...
$("input[value*='" + cId + "']").closest("div[class*='link-black']").attr("background-color", function(iPos, color) {
if(color != highlightColor) { return highlightColor; }
else { return whiteColor; }
}
Any help would be appreciated thanks in advance!!
Consider using
.toggleClassinstead:CSS:
JS: