Simple onclick

by James Hooper

HTML

<div class="test">
<a href="#" title="this is a test click">
    <h2>
    This has not been clicked
    </h2>
    <a class="cancel">cancel</a>
</a>
</div>

JavaScript

var i = ".test a";
var ii = ".test a h2";
var iia = ".test a.cancel";
jQuery(i).click(function() {
	if (jQuery(ii).html() == "this is a test click") {
    	jQuery(this).children("h2").html("Unclicked");
    }
    
    else {
    	jQuery(this).children("h2").html(jQuery(i).attr("title"));
    }
   
});

jQuery(iia).click(function() {
    jQuery(ii).html("This has not been clicked");
});