JSFiddle - React, Tailwind, and code Playground
HTML
<p>jQuery programm with the
<a href="http://en.wikipedia.org/wiki/Reactive_programming">
Reactive programming concept</a>
</p>
<p>X = <span id="X" title="click here">22</span></p>
<p>Y = <span id="Y" title="click here">33</span></p>
<p>A = X+Y = <span id="A"></span> -- click the red boxes</p>
CSS
#Y,#X {background-color:#FAA}
#A {background-color:#AAF}
JavaScript
function setA(){ // A=X+Y as integers
var A = parseInt($('#X').text()) + parseInt($('#Y').text());
$('#A').text( A );
}
setA();
$('#X,#Y').css('cursor','pointer').click(function(){
// by reaction to a click: updates A and X or Y
var obj = $(this);
obj.text(parseInt(obj.text())+1);
setA();
});
//ppkrauss