i'm new to jquery. I have a map, and some selection images(with color, not outline), and i need to use checkbox_click to save the checked area. -> Choose the color on the left side first, and check the map at the right side. then show that color's image on that checked area.
<div class="color_area">
<div class="yellow"></div>
<div class="purple"></div>
</div>
<input type="checkbox" class="hidden_input checkbox_click1" name="mcans1" id="mcans1" value="1" rhandle="yellow">
<input type="checkbox" class="hidden_input checkbox_click1" name="mcans1" id="mcans2" value="1" rhandle="purple">
<div class="click">
<div class="click_yellow checkbox_click checkbox_click1" id=yellow" handle = "mcans1" handle_name="mcans1"><img src="images/yellow1.png" id="yellow"></div>
<div class="click_purple checkbox_click checkbox_click1" id="purple" handle = "mcans1" handle_name="mcans1"><img src="images/purple1.png" id="purple"></div>
</div>
i need to create a function() for determine which color have clicked, and a function() for clear pre-color image when clicked another color.
function color_section(color){
var color_class = $('div').attr('class');
var color = "." + color_class;
if(color == '.yellow'){
return 1;
}
if(color == '.purple'){
return 2;
}
}
i don't know how can checkbox_click know the color i've click.
$('.yellow').click(function(){
//Do this first
$('.checkbox_click1').click(function(){
//find('img.yellow') then
});
});
i have no idea what to do. Somebody help me, please..