I have this for now:
$(document).ready(function () {
var allTdElements = $( "td > div" );
//logic in here
$(document).find(allTdElements).css("background-color", "blue" );
});
I find all td has div in it but now I want to find in that div what background has. For example It could be 2 different colors green and red. And if its red i'll change the color to another, and green the same as red.
But between the instruction of var allTdElements = $( "td > div" );
and $(document).find(allTdElemen...
i don't know how to search it.
After change a few thing I got this:
$(document).ready(function () {
var allTdElements = $( "td > div" );
var color = $( allTdElements ).css( "background-color" );
if (color == 'red')
$(document).find(allTdElements).css("background-color", "red" );
else
$(document).find(allTdElements).css("background-color", "green" );
});
But I want to change the td what contain the div.
PROBLEM SOLVED:
Thanks to @Stewartside. I'll write the solution of anyone has the same problem.
$(document).ready(function() {
$('td div').each(function() {
$(this).parent().css('background-color', $(this).css('background-color'));
});
});