帮助,解决方案:
http://jsfiddle.net/guin90/mb5BJ/2/
$("#click").on("click", function(){
if($(this).attr("thesame") == 1){
// Performs div is clicked on it and not on other elements within it.
// It's not working!
} else {
return false;
}
alert("Hellow");
$(this).css("background", "red");
// Only if you clicked the div # click and not on other elements within
// this div. But is not working!? For up when you click on the div
// or span element inside the div # click it also performs the function,
// it is only if clicked on div # click and not on other elements
// within it.
// and performs other functions that I will put
});
HTML:
<div id="click" thesame="1">
<!-- Clicks and does not perform function Click() -->
<span> Title HI! </span>
<!-- Clicks and does not perform function Click() -->
<div id="show_modal"> Show Modal Window </div>
</div>