How to get the value returned by the handler of the previous level of emersion events, without creating a variable?

the <div><b>text</b></div>
$('b').click(function(e){return 10;})
$('div').click(function(e){/*here to 10?*/})
September 19th 19 at 00:26
2 answers
September 19th 19 at 00:28
Solution
$('b').click(function(e){
 e.target.someVar = 10;
})
$('div').click(function(e){
alert(e.target.someVar);
})


jsfiddle.net/QW01_01/pLnjojxn
Great idea. Thank you! - Arvid.Adams commented on September 19th 19 at 00:31
September 19th 19 at 00:30
I think You should get acquainted with area of visibility of variables in javascript
var foo = 0;
$('b').click(function(e){return foo=10;})
$('div').click(function(e){ console.log(foo) })
Thanks for the reply, but that is not an option. To create variables, sorry, you can't. - Arvid.Adams commented on September 19th 19 at 00:33
well then use localstorage - Arvid.Adams commented on September 19th 19 at 00:36
: it is desirable to use only the event object - Halle_Botsfo commented on September 19th 19 at 00:39

Find more questions by tags jQuery